ropensci / RSelenium

An R client for Selenium Remote WebDriver
https://docs.ropensci.org/RSelenium
343 stars 81 forks source link

httr output: Illegal characters found in URL (chrome not reachable) #232

Open mario-metriplica opened 4 years ago

mario-metriplica commented 4 years ago

Hi,

I am trying to use remoteDriver(browserName = "chrome") and I find a fatal error. I wish you can help me, please.

The steps I follow are:

> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 16.04.5 LTS

system("xvfb-run -a java -Dwebdriver.chrome.driver=/home/mario/chromedriver -jar /home/mario/selenium-server-standalone-3.13.0.jar -port 4444",wait=FALSE) # Twitter

13:41:44.327 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.13.0', revision: '2f0d292'
13:41:44.328 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
2020-04-06 13:41:44.635:INFO::main: Logging initialized @1024ms to org.seleniumhq.jetty9.util.log.StdErrLog
13:41:45.242 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
eCaps <- list(chromeOptions = list(
  args = c('--disable-extensions',
           '--disable-plugins-discovery')))
remDr <- remoteDriver(browserName = "chrome", port = 4444L, extraCapabilities = eCaps)
remDr$open(silent = TRUE)

And the output message:

13:52:52.529 INFO [ActiveSessionFactory.apply] - Capabilities are: {
  "browserName": "chrome",
  "chromeOptions": {
    "args": [
      "--disable-extensions",
      "--incognito",
      "--disable-plugins-discovery",
      "--disable-web-security"
    ]
  },
  "javascriptEnabled": true,
  "nativeEvents": true,
  "version": ""
}
13:52:52.530 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706) on port 9651
Only local connections are allowed.
13:52:53.287 INFO [ProtocolHandshake.createSession] - Detected dialect: OSS
13:52:53.500 INFO [RemoteSession$Factory.lambda$performHandshake$0] - Started new session ab0283f74f2448039fd5b78676cdd626 (org.openqa.selenium.chrome.ChromeDriverService)
remDr$navigate("https://www.google.com")
search <- remDr$findElement("css",".gLFyf.gsfi")

the output message of "search" object is chrome unreachable:

[1] "remoteDriver fields"
$remoteServerAddr
[1] "localhost"

$port
[1] 4444

$browserName
[1] "chrome"

$version
[1] ""

$platform
[1] "ANY"

$javascript
[1] TRUE

$nativeEvents
[1] TRUE

$extraCapabilities
$extraCapabilities$chromeOptions
$extraCapabilities$chromeOptions$args
[1] "--disable-extensions"        "--disable-plugins-discovery"
[4] "--disable-web-security"     

[1] "webElement fields"
$elementId
[1] "chrome not reachable\n  (Session info: chrome=80.0.3987.163)\n  (Driver info: chromedriver=2.41.578700 (2f1ed5f9343c13f73144538f15c00b370eda6706),platform=Linux 4.15.0-1058-gcp x86_64)"

So, when I try to send a word to the active element with search$sendKeysToElement(list("hello")) I obtain the following error:

Error in checkError(res) : 
  Undefined error in httr call. httr output: Illegal characters found in URL