getElementAttribute {seleniumPipes}R Documentation

Get the value of an element's attribute.

Description

getElementAttribute Get the value of an element's attribute.

Usage

getElementAttribute(webElem, attribute, ...)

Arguments

webElem

An object of class "wElement". A web Element object see wbElement.

attribute

The attribute to query as a character string.

...

Additonal function arguments - Currently passes the retry argument.

Value

The value of the attribute, or null if it is not set on the element.

See Also

Other elementState functions: getElementCssValue, getElementProperty, getElementRect, getElementTagName, getElementText, isElementEnabled, isElementSelected

Examples

## Not run: 
  remDr <- remoteDr()
  remDr %>% go("http://www.google.com/ncr")

  # select the search box
  searchElem <- remDr %>% findElement("name", "q")

  # get the name of our element
  searchElem %>% getElementAttribute("name")

  # get the css background-color
  searchElem %>% getElementCssValue("background-color")
  blueScript <- "arguments[0].style.backgroundColor = 'blue';"
  remDr %>% executeScript(blueScript, list(searchElem))
  searchElem %>% getElementCssValue("background-color")

  # get the javascript property
  # searchElem %>% getElementProperty("backgroundColor")

  # get dimensions
  searchElem %>% getElementRect

  searchElem %>% getElementTagName

  # get some text and return it
  remDr %>% go("http://r-project.org")
  remDr %>% findElement("css", "h1") %>% getElementText

  # close browser
  remDr %>% deleteSession

## End(Not run)


[Package seleniumPipes version 0.3.7 Index]