0

I am trying to log in to a site that uses facebook login, using RSelenium. I can enter my email and password and click login, but then returns a "NoSuchWindow" error. Is this because the Facebook login tab automatically closes? How can I prevent this error?


rm(list = ls())

library(RSelenium)
library(keyring)
library(rvest)
library(magrittr)

# Start Selenium Session
#docker run -d -p 4445:4444 selenium/standalone-firefox
remDr <- RSelenium::remoteDriver(remoteServerAddr = "localhost",
                                 port = 4445L,
                                 browserName = "firefox")
remDr$open()

remDr$navigate("https://www.furimawatch.net/signin/")
remDr$findElement('xpath', '//*[@id="btnTermsAgree"]')$clickElement()
remDr$findElement('xpath', '//*[@id="btnFacebookSignin"]')$clickElement()
remDr$switchToWindow(setdiff(remDr$getWindowHandles(), remDr$getCurrentWindowHandle())[[1]])
remDr$findElement('xpath', '//*[@id="email"]')$sendKeysToElement(list("email"))
remDr$findElement('xpath', '//*[@id="pass"]')$sendKeysToElement(list("password"))
remDr$findElement('xpath', '//*[@id="loginbutton"]')$clickElement()
remDr$screenshot(display = TRUE)

This returns the following error:

Selenium message:Browsing context has been discarded
Build info: version: '4.3.0', revision: 'a4995e2c09*'
System info: host: '0d8a70d5e451', ip: '172.17.0.2', os.name: 'Linux', os.arch: 'amd64', os.version: '5.10.104-linuxkit', java.version: '11.0.15'
Driver info: driver.version: unknown

Error:   Summary: NoSuchWindow
     Detail: A request to switch to a different window could not be satisfied because the window could not be found.
     class: org.openqa.selenium.NoSuchWindowException
     Further Details: run errorDetails method
knkn1711
  • 35
  • 6

1 Answers1

0

You are facing NoSuchWindow error as the Browsing context has been discarded which is due to the incompatibility between the versions of the binary executables (WebDriver & Browser).

This symptom is reflected as in:

Driver info: driver.version: unknown

which implies the webdriver version can't be recognized due to incompatibility.

Following the compatibility matrix will address the issue.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352
  • Thank you, could that still happen when I am using Docker? I run: `docker pull selenium/standalone-firefox` and `docker run -d -p 4445:4444 selenium/standalone-firefox` before running my code. I am using version 103.0 of Firefox and MacOS 12.5. What would I exactly need to do to fix the incompatibility issue? – knkn1711 Jul 27 '22 at 22:08
  • Not a docker expert but at times docker does shows glitches due to version compatibilty issues. See: [this](https://stackoverflow.com/questions/63373403/org-openqa-selenium-nosuchsessionexception-unable-to-find-session-with-id-error/63442880#63442880) and [this](https://stackoverflow.com/a/70974335/7429447) discussion. – undetected Selenium Jul 27 '22 at 22:18