Browse Source

Try to move elegantly handle broken pages

pull/51/head
Wesley Kerfoot 5 years ago
parent
commit
f4b015b95f
  1. 12
      deletefb/tools/likes.py

12
deletefb/tools/likes.py

@ -64,13 +64,17 @@ def unlike_page(driver, url, archive=None):
print("Unliking {0}".format(url))
wait = WebDriverWait(driver, 30)
wait = WebDriverWait(driver, 60)
actions = ActionChains(driver)
wait.until(
EC.presence_of_element_located((By.XPATH, "//*[text()='Liked']"))
)
try:
wait.until(
EC.presence_of_element_located((By.XPATH, "//*[text()='Liked']"))
)
except SELENIUM_EXCEPTIONS:
# Something went wrong with this page, so skip it
return
button = driver.find_element_by_xpath("//*[text()='Liked']")

Loading…
Cancel
Save