retry {seleniumPipes} | R Documentation |
Documetation of retry argument
Description
The ability to retry
function code is enabled by default.
retry
can be a logical value.
if it is TRUE then noTry = getOption("seleniumPipes_no_try")
and delay = getOption("seleniumPipes_no_try_delay")
.
If it is FALSE the facility to have multiple trys of the function call is removed. retry
can also be
a list with the following named arguments that will override the values in options
- "noTry"
Integer indicating how many times to try the function call
- "delay"
Integer indicating delay between trys of the function call
Examples
## Not run:
remDr <- remoteDr()
webElem <- remDr %>% go("http://www.google.com/ncr") %>%
findElement("name", "q")
# change the name of q with an 8 second delay
myscript <- "var myElem = arguments[0];
window.setTimeout(function(){
myElem.setAttribute('name','funkyname');
}, 8000);"
remDr %>% executeScript(myscript, args = list(webElem))
newWebElem <- remDr %>% findElement("name", "funkyname")
# > newWebElem <- remDr %>% findElement("name", "funkyname")
#
# Calling findElement - Try no: 1 of 3
#
# Calling findElement - Try no: 2 of 3
newWebElem %>% getElementAttribute("name")
# compare with a function that will fail (no element present)
remDr %>% findElement("id", "i am not here", retry = list(noTry = 5, delay = 10))
remDr %>% findElement("id", "i am not here", retry = FALSE)
## End(Not run)
[Package seleniumPipes version 0.3.7 Index]