Is it possible to save a HAR file from the network tab of browser using RSelenium?

29 Views Asked by At

I can pull up a webpage, right click, go to inspect, open network tab, right click and save all files as HAR. This basically gives me a big JSON file with all the data I want.

Is it possible to automate this process using RSelenium?

These are the steps I've tried so far on Windows 7.

  1. Turn on standalone Selenium server from the CMD

    java -Dwebdriver.chrome.driver=C:\Users\admin\chromedriver.exe -jar selenium-server-standalone-4.0.0-alpha-1.jar

  2. Navigate to the webpage in R

    driver <- rsDriver(browser = "chrome", chromever = "latest", port = 4444L)

    remDr <- driver$client

    remDr$open()

    remDr$navigate(url)

I am not sure how to proceed from here. I need RSelenium to open the developer tools somehow. I think I need to run some sort of java command using remDr$executeScript().

Does anyone know how to get RSelenium to scrape the HAR file? Perhaps there is a completely different approach that is much simpler.

Thank you for the assistance

0

There are 0 best solutions below