Do you want to share your content on R-bloggers? Click here if you have a blog, or here If you don’t.
Due to delays with my stock market payment, if this message is useful for you, I kindly request a minimal donation Buy a coffee for me. It will be used to continue my open source efforts. The complete explanation is here: A personal message from an Open Source employee.
You can send me questions for the blog using This form And subscribe to receive an e -mail when there is a new message.
Motivation
I have this question: I followed your selenium post and it doesn’t work on Windows. How can I solve that?
The post in question is hereAnd after testing on a Windows machine, I realized that the problem was related to facts that newer Google Chrome versions (> 119) do not offer a chromedriver, a software that Selenium uses to control the browser and does not work with the most recent version that you can download from Google.
Here you can read how you can use Mozilla Firefox instead.
Required software
- Mozilla Firefox and Geckodriver: Web browser and remote control program
- Relselenium: R-selenium integration
- Rvest: HTML processing
- DPLYR: To load the pipe operator (can be used later for data cleaning)
- PURRR: ITERATION (ie repeated edits)
I installed Mozilla Firefox from the Official website And followed the installation program.
For Gekkodriver I downloaded it from here For Windows 64-bit and stored “Geckodriver.exe” to a new folder “C:”. Then I had to add the folder to the path as follows:
- Press Win + S
- Type “Environmental variables”
- Open “edit the system environment variables”.
- Click on “variables of environmental variables”.
- Search and select in “System variables” and select “PAD” and then click “Edit”.
- Click on “New” and add “C:” without quotes
- Click OK to save.
Then restart Rstudio and close Powershell when it is open. Not installing Geckodrive would only result in this error message in R: “Can’t create a new service kodrigver service.”
I have installed Relenium from the R console:
if (!require(RSelenium)) install.packages("RSelenium")
# or
remotes::install_github("ropensci/RSelenium")For the rest of the packages:
if (!require(rvest)) install.packages("rvest")
if (!require(dplyr)) install.packages("dplyr")
if (!require(purrr)) install.packages("purrr")Perform Selenium server
I tried to start Selenium as mentioned in the official guideAnd in the post mentioned above, and it didn’t work.
I also had to download selenium server, so I used This link And I ran from a new Powershell:
cd Downloads java -jar selenium-server-standalone-3.9.1.jar
From Rstudio (the same for an R -terminal), I could arrange the browser of R:
library(RSelenium) library(rvest) library(dplyr) library(purrr) rmDr <- remoteDriver(port = 4444L, browserName = "firefox") rmDr$open(silent = TRUE) url <- "https://pacha.dev/blog" rmDr$navigate(url)
This should display a new Firefox window and show my blog. The rest of the steps are the same as the previous message.
I hope this is useful 🙂
Related
#Step #step #manual #Selenium #Windows #RBloggers


