Capturing pages behind Facebook login

Hi there!

I am looking to create screenshots of orders I receive on Facebook Marketplace. Marketplace doesn’t have an API unfortunately so I need to take a screenshot to capture customer info automatically.

I have a question regarding security, by using the login credentials, can Facebook detect that lamdatest is doing the login instead of a human? Facebook is very sensitive to bots and I don’t want to get my account banned. Also my Chrome browser retains cookies so Facebook never asks me to log in and maintains the session indefinitely. Thanks for any help!

Hey @maryamahmed007

As you rightly mentioned, FB is sensitive toward bots and other kind of automation techniques that let you interact with the elements on the page. The task mentioned by you can be done by creating Automation Scripts in Selenium supported languages (e.g. Python, Java, etc.). It i all about logging-in to your FB Marketplace account and scrapping the relevant data from the page.

However, in order to ensure that nothing happens to your account (considering that it is a marketplace), can you share some more details:

Q. Marketplace doesn’t have an API unfortunately to take screenshots A. This can be done by using screenshot APIs provided by Selenium. You can take full page screenshot as well as screenshot of the desired element, some example here and here.

Q. I have a question regarding security, by using the login credentials, can Facebook detect that LambdaTest is doing the login instead of a human? A. Facebook (and other websites) obviously can detect if the login is performed an automation script (e.g. Selenium). However, using a (proxy + headless) browser combination is a sure shot way of inviting trouble since Facebook will realize that the login was done without invoking any instance of the browser.

You can invoke browsers in the non-headless mode so that such issue does not arise

I have tried out Selenium scripts to login to my Facebook account but the frequency was not so high :slight_smile: Can you please mention what is the frequency at which you intend to scrap the data from the marketplace Orders page, scraping the data should not be a challenge (PS - I scrapped YT Data here and it was not very difficult).

Q. Also my Chrome browser retains cookies so Facebook never asks me to log in and maintains the session indefinitely. A. You can use the method deleteAllCookies (in Java and/or equivalent APIs in other languages) to clear the browser cookies. A better option is to set the following Chrome preferences to 2 (for running Selenium tests with Cookies turned off on the browser):

ChromeOptions ch_options = new ChromeOptions();
ch_options.AddUserProfilePreference("profile.default_content_setting_values.cookies", 2);

The above prefs would change when you use the Firefox browser.

Can you please share the information on how the FB marketplace page (looks like) since it will give a rough idea of how simple/difficult would it be to scrap data. Also, please share the frequency at which you plan to perform the scraping activity. (The golden rule is not to get the account banned!)

PS: This is another thread that also mentions why scraping frequency is a huge deciding factor (in FB account getting banned).

1 Like