lundi 26 juin 2017

clicking checkbox using python selenium

I have a little task of scraping data from http://ift.tt/2rS0JG8 . I am unable to perform checkbox tick using my script.

I am doing

from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.common.exceptions import NoSuchElementException
from selenium.common.exceptions import StaleElementReferenceException
driver = webdriver.Chrome()
driver.get('http://ift.tt/2rS0JG8')
driver.find_element_by_xpath("//select[@id='dl-
             profession']/option[@value='9']").click()
driver.find_element_by_xpath("//*[@id='specialty-106']").click()

and getting error as

Traceback (most recent call last):
  File "<pyshell#24>", line 1, in <module>
    driver.find_element_by_xpath("//*[@id='specialty-106']").click()
  File "C:\Python27\lib\site-packages\selenium-2.46.0-py2.7.egg\selenium\webdriver\remote\webelement.py", line 70, in click
    self._execute(Command.CLICK_ELEMENT)
  File "C:\Python27\lib\site-packages\selenium-2.46.0-py2.7.egg\selenium\webdriver\remote\webelement.py", line 404, in _execute
    return self._parent.execute(command, params)
  File "C:\Python27\lib\site-packages\selenium-2.46.0-py2.7.egg\selenium\webdriver\remote\webdriver.py", line 195, in execute
    self.error_handler.check_response(response)
  File "C:\Python27\lib\site-packages\selenium-2.46.0-py2.7.egg\selenium\webdriver\remote\errorhandler.py", line 170, in check_response
    raise exception_class(message, screen, stacktrace)
WebDriverException: Message: unknown error: Element <input type="checkbox" id="specialty-106" name="Specialty[]" value="106"> is not clickable at point (281, 554). Other element would receive the click: <label for="specialty-106"></label>
  (Session info: chrome=58.0.3029.110)
  (Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Windows NT 6.1.7600 x86_64)




Aucun commentaire:

Enregistrer un commentaire