When I try to run the following lines with a single command
mybrowser$navigate("http://www.decolar.com/shop/flights/results/roundtrip/BSB/VCP/2016-06-15/2016-06-19/1/0/0")
eprice <- mybrowser$findElements(using = 'css selector',"#clusters .price-amount" )
It produces the following error:
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: org.openqa.selenium.WebDriverException
However, when I run the last line alone after the error it works just fine:
> eprice <- mybrowser$findElements(using = 'css selector',"#clusters .price-amount" )
> summary(eprice)
Length Class Mode
[1,] 1 webElement S4
[2,] 1 webElement S4
[3,] 1 webElement S4
[4,] 1 webElement S4
[5,] 1 webElement S4
[6,] 1 webElement S4
[7,] 1 webElement S4
[8,] 1 webElement S4
[9,] 1 webElement S4
[10,] 1 webElement S4
I want to run these lines inside a function so that I can get the flight prices from the site but they don’t work automatically. I’ve tried to set Sys.sleep(4)
and mybrowser$setImplicitWaitTimeout(4)
between them and it didn’t work.
When inside function the error trackback is as follows:
Error: Summary: UnknownError
Detail: An unknown server-side error occurred while processing the command.
class: org.openqa.selenium.WebDriverException
5 stop(errMessage, call. = FALSE)
4 checkStatus()
3 queryRD(paste0(serverURL, "/session/", sessionInfo$id, "/elements"),
"POST", qdata = toJSON(list(using = using, value = value)),
json = TRUE)
2 mybrowser$findElements(using = "css selector", "#clusters .price-amount")
1 getPrices()