Description Usage Arguments Value See Also Examples
getActiveElement
Get the element on the page that currently has focus. The located element will be returned as a WebcElement object.
1 | getActiveElement(remDr, ...)
|
remDr |
An object of class "rDriver". A remote driver object see |
... |
Additonal function arguments - Currently passes the |
invisible(wbElement(res$value, remDr)): An object of class "wElement" is invisibly returned.
A webElement object see wbElement
. This allows for chaining from this function to
other functions that take such an object as an argument. See examples for further details.
Other elementRetrieval functions: findElementFromElement
,
findElementsFromElement
,
findElements
, findElement
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 | ## Not run:
remDr <- remoteDr()
remDr %>% go("http://www.google.com/ncr")
# find the search form query box and search for "R project"
webElem <- remDr %>% findElement("name", "q") %>%
elementSendKeys("R project", key = "enter")
# click the first link hopefully should be www.r-project.org
remDr %>% findElement("css", "h3.r a") %>% elementClick
# get the navigation div
navElem <- remDr %>% findElement("css", "div[role='navigation']")
# find all the links in this div
navLinks <- navElem %>% findElementsFromElement("css", "a")
# check the links
nLinks <- sapply(navLinks, function(x) x %>% getElementText)
# compare with all links
allLinks <- remDr %>% findElements("css", "a")
aLinks <- sapply(allLinks, function(x) x %>% getElementText)
# show the effect of searching for elements from element
aLinks %in% nLinks
remDr %>% deleteSession
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.