I'm using R and RSelenium to get some data from a website, for which I have to fill in a form first. One of the elements I have to define in the form is a date.
The box containing the date has the following html code:
<input readonly="readonly" name="Datei" id="Datei" onfocus="popUpCalendar(this, this,'dd/mm/yyyy');return false" maxlength="10" value="" style="width: 200px;" type="text">
I want to set that date to jan 01/2016, or 01/01/2016 to go with the required format.
After getting to the element with
webElem <- rd$findElement("id","Datei")
I've tried these two approaches, but none of them worked (because the item is "readonly", I think):
webElem$value <- list("01/01/2016")
and
webElem$sendKeysToElement(list("01/01/2016"))
As suggested here, I tried
webElem$executeScript(script = "arguments[1].value=arguments[2]",args = list(webElem,"01/01/2016"))
Error: Summary: UnexpectedAlertOpen
Detail: A modal dialog was open, blocking this operation
class: org.openqa.selenium.UnhandledAlertException
I'm running out of ideas, any hint is highly appreciated!
EDIT TO ADDI found (and posted) an answer. I would like to know, though, if somebody knows of a better approach (using httr
, for instance).