Search code examples
rseleniumweb-scrapingrvestrselenium

Maximize browser window with RSelenium


Is there a way to maximize the browser window with RSelenium?

My current code is:

scrape_url <- "https://[...]"

eCaps <- list(firefoxOptions = list(
    args = list('--user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)"')
))
    
rD <- RSelenium::rsDriver(browser="firefox", port=4546L, verbose=F, chromever="87.0.4280.20",
                              extraCapabilities = eCaps)
    
remDr <- rD[["client"]]
remDr$navigate(scrape_url)

Solution

  • Looking at the basic vignette the method is

    remDr$maxWindowSize()
    

    Found here: https://docs.ropensci.org/RSelenium/articles/basics.html#frames-and-windows-1