sendAlertText {seleniumPipes}R Documentation

Send text to alert

Description

sendAlertText Send keystrokes to JavaScript prompt() dialog

Usage

sendAlertText(remDr, text = "", ...)

Arguments

remDr

An object of class "rDriver". A remote driver object see remoteDr.

text

A character vector of length 1. In other words a string. The text is passed to the JavaScript alert

...

Additonal function arguments - Currently passes the retry argument.

Value

invisible(remDr): An object of class "rDriver" is invisibly returned. A remote driver object see remoteDr. This allows for chaining from this function to other functions that take such an object as an argument. See examples for further details.

See Also

Other userPrompts functions: acceptAlert, dismissAlert, getAlertText

Examples

## Not run: 
  remDr <- remoteDr()
  remDr %>% go("https://www.google.com/ncr") %>%
    getTitle()
  sScript <- "setTimeout(function(){alert('HELLO')},1000); return 'DONE';"
  remDr %>% executeScript(sScript, args = list())
  remDr %>% dismissAlert()

  sScript <- "setTimeout(function(){confirm('Press a button')},1000); return 'DONE';"
  remDr %>% executeScript(sScript, args = list())
  remDr %>% acceptAlert()

  sScript <- "setTimeout(function(){confirm('Press a button')},1000); return 'DONE';"
  remDr %>% executeScript(sScript, args = list())
  remDr %>% getAlertText()
  remDr %>% dismissAlert()


  sScript <- "setTimeout(function(){prompt('Please enter your name', '')},1000); return 'DONE';"
  remDr %>% executeScript(sScript, args = list())
  remDr %>% getAlertText()
  remDr %>% sendAlertText("Buck Rogers?")

  remDr %>% deleteSession()


## End(Not run)

[Package seleniumPipes version 0.3.7 Index]