here에서 텍스트를 크롤링하고 있습니다. 반복적으로 "Load More Arguments"를 클릭하여 페이지에 나열된 모든 인수를 가져와야합니다. 여기Selenium을 반복 사용하여 콘텐츠를 얻는 방법 <Python>?
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
오류입니다 : 여기 내 코드는
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:
내가 페이지에 나열된 인수를 취득 할 수 있지만, 나는 내 코드는 특히 루프에서, 조금 이상하다 생각합니다. "클릭 할 수 없음"과 같은 "그렇지 않다면"을 대체 할 항목이 필요하다고 생각합니다. 나에게 제안을 좀 해줄 수 있니?
감사합니다.
설명해 주셔서 감사합니다. 정말 도움이됩니다. :) – theteddyboy