From bf6ce1d615deef413975f801212b68730e54a945 Mon Sep 17 00:00:00 2001 From: Wesley Kerfoot Date: Sun, 2 Jun 2019 15:38:40 -0400 Subject: [PATCH] Match anything with "Unlike" for pages because FB keeps changing the elements --- deletefb/tools/likes.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deletefb/tools/likes.py b/deletefb/tools/likes.py index 9498f2e..a245961 100644 --- a/deletefb/tools/likes.py +++ b/deletefb/tools/likes.py @@ -59,6 +59,7 @@ def unlike_page(driver, url): """ driver.get(url) + print(url) wait = WebDriverWait(driver, 30) actions = ActionChains(driver) @@ -73,11 +74,11 @@ def unlike_page(driver, url): click_button(driver, button) wait.until( - EC.presence_of_element_located((By.XPATH, "//a/span[text()='Unlike']")) + EC.presence_of_element_located((By.XPATH, "//*[text()='Unlike']")) ) # There should be an "Unlike" button now, click it - unlike_button = driver.find_element_by_xpath("//a/span[text()='Unlike']/..") + unlike_button = driver.find_element_by_xpath("//*[text()='Unlike']/..") click_button(driver, unlike_button)