FBEraser icon indicating copy to clipboard operation
FBEraser copied to clipboard

Make the script work for modern (Fall 2017) activity page

Open landaire opened this issue 6 years ago • 1 comments

As this stands right now this should not be merged since the code can be cleaned up and made better. There's a lot of weird stuff from me figuring out Selenium and Facebook's activity page weirdness.

Basically the changes are:

  • Wait for elements to be found by Selenium instead of using timing (for the most part -- some cases didn't work for this)
  • Add indicators of what was skipped, where errors happened, and what was hidden/deleted
  • Add support for passing in --days to delete posts older than N days
  • Add support for doing a dry run
  • Slightly different logic for loading the full activity. If you only keep scrolling down, eventually Facebook will stop loading activity past a certain point. For me it ended in 2012 when I had posts going back to 2008. I changed this logic so that the script will click on each of the years that are present on the right of the page which loads that activity, then it will go through and repeatedly click the "More Activity" button to load activity
  • After loading all activity posts start to be deleted. This logic is somewhat strange right now because the way I initially did this was to do some weirdness with scrolling to the element since Selenium's WebElement.click() function will literally emulate a mouse click at that coordinate rather than just triggering the action. This resulted in some weirdness with either the element being off-screen so it couldn't be clicked, the header getting in the way, or there not being enough room to show the full menu so Facebook wouldn't pop it. I ended up changing this logic so that instead I execute JavaScript to trigger the click() event which works a lot nicer but the old scroll logic remains
  • Some of the functions do too much and change behavior based off of an additional parameter which I don't really like and could modify
  • There's an off-by-one error of sorts where the final modal dialog for deleting items isn't clicked... not sure what the deal with this is but I think it has to do with the XPath for the modal.

I wanted to make the PR for awareness though and can clean this up in a bit.


This change is Reviewable

landaire avatar Nov 19 '17 20:11 landaire

Awesome, thanks for doing this! Will take a look in the next day or two.

asonawalla avatar Nov 20 '17 14:11 asonawalla