Try to use untag button if delete or hide is not an option #44

Merged
weskerfoot merged 1 commits from untag into master 6 years ago
  1. 3
      deletefb/tools/wall.py

3
deletefb/tools/wall.py

@ -44,7 +44,10 @@ def delete_posts(driver,
try:
delete_button = menu.find_element_by_xpath("//a[@data-feed-option-name=\"FeedDeleteOption\"]")
except SELENIUM_EXCEPTIONS:
try:
delete_button = menu.find_element_by_xpath("//a[@data-feed-option-name=\"HIDE_FROM_TIMELINE\"]")
except SELENIUM_EXCEPTIONS:
delete_button = menu.find_element_by_xpath("//a[@data-feed-option-name=\"UNTAG\"]")
jsmbennett commented 6 years ago (Migrated from github.com)
Review

I'll test this when I get home from work today, I believe this should do the trick.

That being said, I wonder if it makes more sense to find all possible <a data-feed-option-name> elements at once in a list, and then check loop over their option names in precendence of DELETE, HIDE, UNTAG, along with any other tags you may discover.

I'll test this when I get home from work today, I believe this should do the trick. That being said, I wonder if it makes more sense to find all possible `<a data-feed-option-name>` elements at once in a list, and then check loop over their option names in precendence of DELETE, HIDE, UNTAG, along with any other tags you may discover.
weskerfoot commented 6 years ago (Migrated from github.com)
Review

Yes that makes sense. I wanted to make sure it didn't break anything first, but I think it should be ok to just check them in a loop and then use the first one that actually exists in priority.

Yes that makes sense. I wanted to make sure it didn't break anything first, but I think it should be ok to just check them in a loop and then use the first one that actually exists in priority.
actions.move_to_element(delete_button).click().perform()
confirmation_button = driver.find_element_by_class_name("layerConfirm")

Loading…
Cancel
Save