I am crawling text from here. I need to repeatedly click on "Load More Arguments" to obtain all arguments listed on the page. Here is my code:
try:
while True:
link = WebDriverWait(driver, 5).until(
EC.element_to_be_clickable((By.LINK_TEXT, "Load More Arguments")))
ActionChains(driver).move_to_element(link).perform()
link.click()
time.sleep(3) #wait for the update to occurr so the page loads"new arguments for you"
print(driver.execute_script("return document.documentElement.outerHTML;"))
if not (link):
break
finally:
None
Here is the error:
File "debate.py", line 42, in <module>
EC.element_to_be_clickable((By.LINK_TEXT, "Load More Arguments")))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/selenium-2.44.0-py2.7.egg/selenium/webdriver/support/wait.py", line 71, in until
raise TimeoutException(message)
selenium.common.exceptions.TimeoutException: Message:
I do obtain the arguments listed on the page but I think my code is a bit strange, especially in the loop. I think I need something to replace "if not" like "not clickable". Could you please give me some suggestion?
Thank you.