Selenium brave automation: How do you scroll down a js script generated page and save the HAR file?

Chromium based browser’s HAR log et download utility is very useful and accessing it via Selenium automation makes it even better, but a search on:

“import org.openqa.selenium.chrome.ChromeDriver” ChromeOptions setBinary HAR

would give you only 3 useless results
~
Automating Chromium through Selenium takes:

  1. downloading the latest “webdriver.chrome.driver” (or whichever you need corresponding to the chromium-based browser you will be automating)
  2. System.set(ting)Property(“webdriver.chrome.driver”, “<local path to wherever you have the webdriver.chrome.driver §1>”)
  3. downloading the corresponding chromium-based browser binaries specified for webdriver in §1
  4. ChromeOptions ChrmOps = new ChromeOptions().set(ting)Binary(“<local path to wherever you have the webdriver.chrome.driver §3>”);

which basically becomes and just 4 lines of set up code:

System.setProperty(“webdriver.chrome.driver”, “<local path to wherever you have the webdriver.chrome.driver §1>”);
ChromeOptions ChrmOps = new ChromeOptions();
ChrmOps.setBinary(“<local path to wherever you have the webdriver.chrome.driver §3>”);
WebDriver WbDrvr = new ChromeDriver(ChrmOps);

WbDrvr.manage().window().maximize().get(“https://stackoverflow.com/questions/tagged/selenium-webdriver%2Bjava?tab=Votes”);;
~
Use for example that page:
https://archive.org/search?query=(“Mehrwert” OR “Surplus Value”) AND (“Petty” OR “Ricardo” OR “Smith” OR “Marx” OR “Sraffa”)

How would you then set the networking logs, scroll down the js generated page and save the HAR file using automation?

Any suggestions, books, links, … as to how you could achieve such a feast?

lbrtchx

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.