I'm trying to click an options from a website dropdown menu but I am not able to click.
I am using "xpath" locators for the element and I upgraded my chrome to the latest version for chromedriver.
I am using:
- chrome=68.0.3440.106
- chromedriver=2.41.578700
- platform=Linux 4.15.0-30
Code snippet that contains error line:
def test_adsz(self):
driver = self.driver
driver.get("url")
driver.find_element_by_xpath("//img[@alt='Dersomani']").click()
driver.find_element_by_xpath(u"(//a[contains(text(),'Sınıf')])[2]").click()
driver.find_element_by_xpath(u"(//a[contains(text(),'ÜYE GİRİŞİ')])[2]").click()
driver.find_element_by_name("email").clear()
driver.find_element_by_name("email").send_keys("admin")
driver.find_element_by_name("password").clear()
driver.find_element_by_name("password").send_keys("12345")
driver.find_element_by_xpath(u"(.//*[normalize-space(text()) and normalize-space(.)='alın'])[1]/following::button[1]").click()
driver.find_element_by_xpath("//img[@alt='User Name']").click()
driver.find_element_by_xpath(u"(//a[contains(text(),'Yönetici')])[2]").click()
driver.find_element_by_link_text(u"Üye Listesi").click()
driver.find_element_by_xpath(u"(.//*[normalize-space(text()) and normalize-space(.)='Tanım İşlemleri'])[1]/following::span[1]").click()
driver.find_element_by_link_text("Profilim").click()
driver.find_element_by_xpath("//div[@id='logged_in']/a").click()
driver.find_element_by_xpath(u"(//a[contains(text(),'Çıkış Yap')])[2]").click()
My error line:
driver.find_element_by_xpath(u"(//a[contains(text(),'Sınıf')])[2]").click()
My traceback info:
traceback (most recent call last):
driver.find_element_by_xpath(u"(//a[contains(text(),'Sınıf')])
[2]").click()
File "/usr/local/lib/python2.7/dist-
packages/selenium/webdriver/remote/webelement.py", line 80, in click
self._execute(Command.CLICK_ELEMENT)
File "/usr/local/lib/python2.7/dist-
packages/selenium/webdriver/remote/webelement.py", line 628, in
_execute
return self._parent.execute(command, params)
File "/usr/local/lib/python2.7/dist-
packages/selenium/webdriver/remote/webdriver.py", line 320, in execute
self.error_handler.check_response(response)
File "/usr/local/lib/python2.7/dist-
packages/selenium/webdriver/remote/errorhandler.py", line 242, in
check_response
raise exception_class(message, screen, stacktrace)
ElementNotVisibleException: Message: element not visible`
Thanks in advance.
driver.find_element_by_xpath(u"(//a[contains(text(),'1. Sınıf')]) [2]").click()however you mention linedriver.find_element_by_xpath(u"(//a[contains(text(),'Sınıf')])[2]").click(). So eventually which line does produce the error?driver.find_element_by_xpath(u"(//a[contains(text(),'Sınıf')])[2]").click()@AlexeyR.