type {parsel}R Documentation

wrapper around sendKeysToElement() method to generate safe scraping code

Description

wrapper around sendKeysToElement() method to generate safe scraping code

Usage

type(
  using,
  value,
  name = NULL,
  text,
  text_object,
  new_page = FALSE,
  prev = NULL
)

Arguments

using

character string specifying locator scheme to use to search elements. Available schemes: "class name", "css selector", "id", "name", "link text", "partial link text", "tag name", "xpath".

value

character string specifying the search target.

name

character string specifying the object name the RSelenium "wElement" class object should be saved to.If NULL a name will be generated automatically.

text

a character vector specifying the text to be typed.

text_object

a character string specifying the name of an external object holding the text to be typed. Note that the remDr$sendKeysToElement method only accepts list inputs.

new_page

logical indicating if sendKeysToElement() action will result in a change in url.

prev

a placeholder for the output of functions being piped into type(). Defaults to NULL and should not be altered.

Value

a character string defining 'RSelenium' typing instructions that can be pasted into a scraping function.

Examples

## Not run: 

#navigate to wikipedia, type "Hello" into the search box,  press enter

parsel::go("https://www.wikipedia.org/") %>>%
parsel::type(using = "id",
             value = "'searchInput'",
             name = "searchbox",
             text = c("Hello","\uE007")) %>>%
             show()

#navigate to wikipeda, type content stored in external object "x" into search box

parsel::go("https://www.wikipedia.org/") %>>%
parsel::type(using = "id",
             value = "'searchInput'",
             name = "searchbox",
             text_object = "x") %>>%
             show()


## End(Not run)

[Package parsel version 0.3.0 Index]