So I am very new and trying to figure out something for use in python.
The element:
<div id="scroll2" class="fm2 p8 cur m_bt2" onclick="javascript:displayResultsLogin('scroll2')"> Show More Results </div>
Xpath: //*[@id="scroll2"]
I execute, using shell:
wait = WebDriverWait(driver, 10)
element = wait.until(EC.element_to_be_clickable((By.XPATH, "//*[contains(text(), ' Show More Results')]")))
element.click()
Once the above has executed, the element:
<div id="scroll3" class="fm2 p8 cur m_bt2" onclick="javascript:displayResultsLogin('scroll3')"> Show More Results </div>
XPath: //*[@id="scroll3"]
When I execute the same command again, it throws an exception:
wait = WebDriverWait(driver, 10)
element = wait.until(EC.element_to_be_clickable((By.XPATH, "//*[contains(text(), ' Show More Results')]")))
element.click()
Exception
Traceback (most recent call last): File "", line 1, in element = wait.until(EC.element_to_be_clickable((By.XPATH, "//*[contains(text(), ' Show More Results')]"))) File "C:\Python34\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until raise TimeoutException(message, screen, stacktrace) selenium.common.exceptions.TimeoutException: Message:
Unable to understand why. Or a way around it.