I run Selenium with docker like this:
docker run -d -p 4445:4444 selenium/standalone-firefox:2.53.1
and this line remDr$findElement(using = "class", "percent") in the following R Script works fine.
library("tidyverse")
library("RSelenium")
# A Selenium server has to be running
# Works with: docker run -d -p 4445:4444 selenium/standalone-firefox:2.53.1
# Fails with: docker run -d -p 4445:4444 selenium/standalone-firefox:latest
remDr <- remoteDriver(port = 4445L)
remDr$open()
remDr$navigate("https://www.alternabank.ca/everyday-banking/high-interest-esavings")
webElem <- remDr$findElement(using = "class", "percent")
tmp <- webElem$getElementText()
remDr$close()
I kill that container and do: docker run -d -p 4445:4444 selenium/standalone-firefox:latest
And then run the same code again. This results in an error:
> webElem <- remDr$findElement(using = "class", "percent")
Error in .self$value[[1]] : subscript out of bounds
Why is this? How can I get my old code to work with the latest version of firefox. I need the newer version for some other things to work.
I also see that the name of the linux process changes from "firefox" to "Gecko".
When you start the Selenium docker using the command:
Effectively,
selenium/standalone-firefox:2.53.0uses:FIREFOX_VERSIONwhile building it.So, there's no issue in program execution.
But when you start the Selenium docker using the command:
Marionette based GeckoDriver comes into play.
There are quite significant updates/modifications/changes between how the Legacy Firefox Browser was earlier run and how the GeckoDriver currently drives the firefox browser now.
This should also explain why you see that the name of the linux process changes from "firefox" to "Gecko"
Additionally, you need to keep the GeckoDriver synchronized with the Firefox Browser and you can find a relevant detailed discussion in Selenium: How selenium identifies elements visible or not? Is is possible that it is loaded in DOM but not rendered on UI?
TL; DR
StandaloneFirefox 2.53.0 image hosted on hub.docker.com was updated and broke internal build