Query the value of an element's computed CSS property.

Description

getElementCssValue Query the value of an element's computed CSS property. The CSS property to query should be specified using the CSS property name, not the JavaScript property name (e.g. background-color instead of backgroundColor).

Usage

1
getElementCssValue(webElem, propertyName, ...)

Arguments

webElem

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

propertyName

The property to query as a character string

...

Additonal function arguments - Currently passes the retry argument.

Value

The value of the specified CSS property.

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## 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)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.