View source: R/constructors_elements.R
| get_element | R Documentation | 
wrapper around getElementText() method to generate safe scraping code
get_element(using, value, name = NULL, multiple = FALSE, prev = NULL)
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.  | 
multiple | 
 logical indicating whether multiple elements should be returned. If TRUE the findElements() method will be invoked.  | 
prev | 
 a placeholder for the output of functions being piped into get_element(). Defaults to NULL and should not be altered.  | 
a character string defining 'RSelenium' getElementText() instructions that can be pasted into a scraping function.
## Not run: 
#navigate to wikipedia, type "Hello" into the search box,
#press enter, get page header
parsel::go("https://www.wikipedia.org/") %>>%
parsel::type(using = "id",
             value = "'searchInput'",
             name = "searchbox",
             text = c("Hello","\uE007")) %>>%
parsel::get_element(using = "id",
                    value = "'firstHeading'",
                    name = "header") %>>%
            show()
#navigate to wikipedia, type "Hello" into the search box, press enter,
#get page header, save in external data.frame x.
parsel::go("https://www.wikipedia.org/") %>>%
parsel::type(using = "id",
             value = "'searchInput'",
             name = "searchbox",
             text = c("Hello","\uE007")) %>>%
parsel::get_element(using = "id",
                    value = "'firstHeading'",
                    name = "x[,1]") %>>%
                    show()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.