Reputation: 155
This script is entirely working apart from the input text into the longitude and latitude fields, which for some reason are not responsive. Could you please help figuring out how to fix this?
library(RSelenium)
library(tidyverse)
driver <- rsDriver(browser = c("chrome"), chromever = "78.0.3904.105")
remote_driver <- driver[["client"]]
remote_driver$open()
remote_driver$navigate("https://climateknowledgeportal.worldbank.org/download-data#download-data-projections-tab")
type_element <- remote_driver$findElement(using = 'id', value = 'futureType')
variable <- remote_driver$findElement(using = 'id', value = 'variablesFutu')
longitude <- remote_driver$findElement(using = 'class', value = 'longitude')
latitude <- remote_driver$findElement(using = 'id', value = 'latitude')
time_period <- remote_driver$findElement(using = 'id', value = 'futuTimeSeries')
statistic <- remote_driver$findElement(using = 'id', value = 'statistic')
scenario <- remote_driver$findElement(using = 'id', value = 'scenario')
type_element$sendKeysToElement(list("CMIP5"))
variable$sendKeysToElement(list("cdd65"))
time_period$sendKeysToElement(list("2040-2059"))
statistic$sendKeysToElement(list("manom"))
scenario$sendKeysToElement(list("rcp45"))
latitude$sendKeysToElement(list("30")) # does not work
longitude$sendKeysToElement(list("30")) # does not work
button_element <- remote_driver$findElement(using = 'id', value = "downloadProjectionsBtn")
button_element$clickElement()
Upvotes: 0
Views: 276
Reputation: 3503
Not an expert with RSelenium but I see you are identifying latitude as
latitude <- remote_driver$findElement(using = 'id', value = 'latitude')
, when id is in fact latitudeProj
All your fields are lists, except latitude and longitude, but you seem to be sending keys to these two as list item? If you try:
latitude$sendKeysToElement("abc")
would it accept it?
Upvotes: 1