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

Merged
weskerfoot merged 1 commits from untag into master 5 years ago
weskerfoot commented 5 years ago (Migrated from github.com)
Owner
There is no content yet.
jsmbennett (Migrated from github.com) reviewed 5 years ago
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 (Migrated from github.com) commented 5 years ago
Owner

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 (Migrated from github.com) reviewed 5 years ago
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\"]")
weskerfoot (Migrated from github.com) commented 5 years ago
Poster
Owner

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.
weskerfoot commented 5 years ago (Migrated from github.com)
Poster
Owner

Yeah for sure, it can be refactored I think

On Thu, May 30, 2019, 4:30 PM Joseph Bennett notifications@github.com
wrote:

@jsmbennett commented on this pull request.

In deletefb/tools/wall.py
https://github.com/weskerfoot/DeleteFB/pull/44#discussion_r289159963:

@@ -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:

  •                delete_button = menu.find_element_by_xpath("//a[@data-feed-option-name=\"HIDE_FROM_TIMELINE\"]")
    
  •                try:
    
  •                    delete_button = menu.find_element_by_xpath("//a[@data-feed-option-name=\"HIDE_FROM_TIMELINE\"]")
    
  •                except SELENIUM_EXCEPTIONS:
    

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 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.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/weskerfoot/DeleteFB/pull/44?email_source=notifications&email_token=AAC4L3YEIHCLXDEQQWRRBNLPYA2ORA5CNFSM4HRF5M3KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB2FVUPY#pullrequestreview-244013631,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAC4L34OTN6YFK5ELR3IXBLPYA2ORANCNFSM4HRF5M3A
.

Yeah for sure, it can be refactored I think On Thu, May 30, 2019, 4:30 PM Joseph Bennett <notifications@github.com> wrote: > *@jsmbennett* commented on this pull request. > ------------------------------ > > In deletefb/tools/wall.py > <https://github.com/weskerfoot/DeleteFB/pull/44#discussion_r289159963>: > > > @@ -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: > - delete_button = menu.find_element_by_xpath("//a[@data-feed-option-name=\"HIDE_FROM_TIMELINE\"]") > + try: > + delete_button = menu.find_element_by_xpath("//a[@data-feed-option-name=\"HIDE_FROM_TIMELINE\"]") > + except SELENIUM_EXCEPTIONS: > > 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. > > — > You are receiving this because you authored the thread. > Reply to this email directly, view it on GitHub > <https://github.com/weskerfoot/DeleteFB/pull/44?email_source=notifications&email_token=AAC4L3YEIHCLXDEQQWRRBNLPYA2ORA5CNFSM4HRF5M3KYY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGOB2FVUPY#pullrequestreview-244013631>, > or mute the thread > <https://github.com/notifications/unsubscribe-auth/AAC4L34OTN6YFK5ELR3IXBLPYA2ORANCNFSM4HRF5M3A> > . >
The pull request has been merged as 4f910ebee0.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date

No due date set.

Dependencies

This pull request currently doesn't have any dependencies.

Loading…
There is no content yet.