Browse Source

Try to move elegantly handle broken pages

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

6
deletefb/tools/likes.py

@ -64,13 +64,17 @@ def unlike_page(driver, url, archive=None):
print("Unliking {0}".format(url)) print("Unliking {0}".format(url))
wait = WebDriverWait(driver, 30) wait = WebDriverWait(driver, 60)
actions = ActionChains(driver) actions = ActionChains(driver)
try:
wait.until( wait.until(
EC.presence_of_element_located((By.XPATH, "//*[text()='Liked']")) 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']") button = driver.find_element_by_xpath("//*[text()='Liked']")

Loading…
Cancel
Save