├── .Rbuildignore ├── .gitignore ├── .travis.yml ├── DESCRIPTION ├── NAMESPACE ├── NEWS ├── R ├── commandContexts.R ├── commandContextsDoc.R ├── cookies.R ├── cookiesDoc.R ├── documentHandling.R ├── documentHandlingDoc.R ├── elementInteraction.R ├── elementInteractionDoc.R ├── elementRetrieval.R ├── elementRetrievalDoc.R ├── elementState.R ├── elementStateDoc.R ├── init.R ├── interactions.R ├── interactionsDoc.R ├── navigation.R ├── navigationDoc.R ├── oldMethods.R ├── oldMethodsDoc.R ├── screenCapture.R ├── screenCaptureDoc.R ├── sessions.R ├── sessionsDoc.R ├── sysdata.rda ├── userPrompts.R ├── userPromptsDoc.R ├── utils.R └── zzz.R ├── README.md ├── docs ├── acceptAlert.html ├── acceptAlertOld.html ├── addCookie.html ├── back.html ├── checkResponse.html ├── closeWindow.html ├── css │ ├── bootstrap-responsive.css │ ├── bootstrap-responsive.min.css │ ├── bootstrap.css │ ├── bootstrap.min.css │ ├── highlight.css │ └── staticdocs.css ├── deleteAllCookies.html ├── deleteCookie.html ├── deleteSession.html ├── dismissAlert.html ├── dismissAlertOld.html ├── elementClear.html ├── elementClick.html ├── elementSendKeys.html ├── errorContent.html ├── errorResponse.html ├── executeAsyncScript.html ├── executeAsyncScriptOld.html ├── executeScript.html ├── executeScriptOld.html ├── findElement.html ├── findElementFromElement.html ├── findElements.html ├── findElementsFromElement.html ├── forward.html ├── fullscreenWindow.html ├── getActiveElement.html ├── getAlertText.html ├── getAlertTextOld.html ├── getAllCookies.html ├── getCurrentUrl.html ├── getElementAttribute.html ├── getElementCssValue.html ├── getElementProperty.html ├── getElementRect.html ├── getElementTagName.html ├── getElementText.html ├── getNamedCookie.html ├── getPageSource.html ├── getTitle.html ├── getWindowHandle.html ├── getWindowHandleOld.html ├── getWindowHandles.html ├── getWindowHandlesOld.html ├── getWindowPosition.html ├── getWindowPositionOld.html ├── getWindowSize.html ├── getWindowSizeOld.html ├── go.html ├── img │ ├── glyphicons-halflings-white.png │ └── glyphicons-halflings.png ├── index.html ├── isElementEnabled.html ├── isElementSelected.html ├── js │ ├── bootstrap.js │ └── bootstrap.min.js ├── maximizeWindow.html ├── maximizeWindowOld.html ├── newSession.html ├── performActions.html ├── queryDriver.html ├── reference.html ├── refresh.html ├── releasingActions.html ├── remoteDr.html ├── retry.html ├── selKeys.html ├── seleniumPipes.html ├── sendAlertText.html ├── sendAlertTextOld.html ├── setTimeout.html ├── setWindowPosition.html ├── setWindowPositionOld.html ├── setWindowSize.html ├── setWindowSizeOld.html ├── switchToFrame.html ├── switchToParentFrame.html ├── switchToWindow.html ├── takeElementScreenshot.html ├── takeScreenshot.html ├── vignettes │ └── basicOperation.html └── wbElement.html ├── inst ├── Saucetests │ ├── README.md │ ├── runtest.R │ ├── setup.R │ └── test_api_example_tests.R └── examples │ ├── createFunctions.R │ ├── dismissAlert.R │ ├── docs │ ├── commandContexts.R │ ├── cookies.R │ ├── documentHandling.R │ ├── elementInteraction.R │ ├── elementRetrieval.R │ ├── elementState.R │ ├── interactions.R │ ├── navigation.R │ ├── oldMethods.R │ ├── screenCapture.R │ ├── sessions.R │ └── userPrompts.R │ ├── elementSendKeys.R │ ├── executeAsyncScript.R │ ├── executeScript.R │ ├── findElement.R │ ├── findElementFromElement.R │ ├── findElements.R │ ├── findElementsFromElement.R │ ├── getCookie.R │ ├── getElementxxx.R │ └── switchToFrame.R ├── man-roxygen ├── ellipsis.R ├── locator.R ├── remDr.R ├── ret1.R ├── ret10.R ├── ret11.R ├── ret12.R ├── ret13.R ├── ret2.R ├── ret3.R ├── ret4.R ├── ret5.R ├── ret6.R ├── ret7.R ├── ret8.R ├── ret9.R └── webElem.R ├── man ├── acceptAlert.Rd ├── acceptAlertOld.Rd ├── addCookie.Rd ├── back.Rd ├── checkResponse.Rd ├── closeWindow.Rd ├── deleteAllCookies.Rd ├── deleteCookie.Rd ├── deleteSession.Rd ├── dismissAlert.Rd ├── dismissAlertOld.Rd ├── elementClear.Rd ├── elementClick.Rd ├── elementSendKeys.Rd ├── errorContent.Rd ├── errorResponse.Rd ├── executeAsyncScript.Rd ├── executeAsyncScriptOld.Rd ├── executeScript.Rd ├── executeScriptOld.Rd ├── findElement.Rd ├── findElementFromElement.Rd ├── findElements.Rd ├── findElementsFromElement.Rd ├── forward.Rd ├── fullscreenWindow.Rd ├── getActiveElement.Rd ├── getAlertText.Rd ├── getAlertTextOld.Rd ├── getAllCookies.Rd ├── getCurrentUrl.Rd ├── getElementAttribute.Rd ├── getElementCssValue.Rd ├── getElementProperty.Rd ├── getElementRect.Rd ├── getElementTagName.Rd ├── getElementText.Rd ├── getNamedCookie.Rd ├── getPageSource.Rd ├── getTimeouts.Rd ├── getTitle.Rd ├── getWindowHandle.Rd ├── getWindowHandleOld.Rd ├── getWindowHandles.Rd ├── getWindowHandlesOld.Rd ├── getWindowPosition.Rd ├── getWindowPositionOld.Rd ├── getWindowSize.Rd ├── getWindowSizeOld.Rd ├── go.Rd ├── isElementEnabled.Rd ├── isElementSelected.Rd ├── maximizeWindow.Rd ├── maximizeWindowOld.Rd ├── newSession.Rd ├── performActions.Rd ├── pipe.Rd ├── queryDriver.Rd ├── refresh.Rd ├── releasingActions.Rd ├── remoteDr.Rd ├── retry.Rd ├── selKeys.Rd ├── seleniumPipes.Rd ├── sendAlertText.Rd ├── sendAlertTextOld.Rd ├── setTimeouts.Rd ├── setWindowPosition.Rd ├── setWindowPositionOld.Rd ├── setWindowSize.Rd ├── setWindowSizeOld.Rd ├── status.Rd ├── switchToFrame.Rd ├── switchToParentFrame.Rd ├── switchToWindow.Rd ├── takeElementScreenshot.Rd ├── takeScreenshot.Rd └── wbElement.Rd ├── tests ├── README.md ├── testthat.R └── testthat │ ├── helper.R │ ├── setup.R │ ├── test-alerts_tests.R │ ├── test-api_example_tests.R │ ├── test-cookie_tests.R │ ├── test-executing_javascript_tests.R │ ├── test-frame_switching_tests.R │ ├── test-page_loading_tests.R │ └── test-takes_screenshots_tests.R └── vignettes ├── basicOperation.Rmd ├── chromeBrowser.png ├── cranFrameColor.png ├── googleAndCran.png ├── googleBlue.png ├── onlyCRAN.png └── windowsGoogle.png /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^\.travis\.yml$ 4 | web 5 | man-roxygen 6 | ^docs$ 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | seleniumPipes.Rproj 6 | inst/doc 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | language: R 3 | cache: packages 4 | r_github_packages: 5 | - johndharrison/seleniumPipes 6 | services: 7 | - docker 8 | addons: 9 | sauce_connect: true 10 | env: 11 | matrix: 12 | - NOT_CRAN=true 13 | global: 14 | - secure: eppSocqIqALXo5VtKPR1yiBx7LcN1rS8jFxghAxfRpczSJO22xPZtumJw91iTKvZ5vYSI4Y7klP9curF7mMFkfO0tLmqiBoZUMjmBnVytd8XKejpRW1EyTFi+aelNxVm95MXsszn/m4oCwbBxXB8g7dSCy0qOkcaYYri6hxflU9u7+OxLxZdl00VvZbhSF/7YJom0myBTqXHxtJbzPX5PomTzoSnhtTlEMpz2JcRGne581VYvaO5ZbHMlzZPfVeAiZyLEnDIdCARwSQQ2iK9Sfa89Kva+e7Nn1iz8ImLhFz7EA6mHdvTCONi3pZIq7zX4M4wNNx/+/GOS6STLZkArapGFWofAfR1MbzE+EBHla7Zt/N4sG97TapQR8Yy3LGceWdIAZXKljOTyyA+8PoTH8RoaeBOaluinLU4Ej10vIIJPbj330D6qReg5ek9Xmad0/oBRxsxSyE94OmG2E8kwykTWRvQAi/2Wz+v4gGDpZhZHP0bkS4g8BN0oLc1uX5fw+4L083LLNt9Fvx4/fOU3hjaRVLl/tjJRruMfMdUNfcPLqpVvi2t3i0AjJavJT+8wYTKWcN8RwniQFYQaqpeKrK4NeDa3eG8ospPcr9+DszNkWcU7TWTEkVTR8Tuwpb+KOmSqzL1OijY70UaMeuCc5Mp2IvhHef/kziSkcMaBaQ= 15 | - secure: az0ghI7UwdpgzUQabtmoEKyUOf9z/QzT9GiDbZBFwEUn7+cDX+mJ/2GLXj+All9lrDxhaB7h6Ur25OlePynBSI0w6UHJy9IFw30gTVfRY3B1QobCDa0Wbp17xEb1UGyKRB8VOsHWwAlCDwRUuHIwDahtoAQBYBxMJNOf6eQ/2zgAUDOG4ovJMUKBEl+jw/gecJClnXGUINPaXx4cHnHMFCCoMD2FmNX64+2wxsITiitoxexqLhCxisXZkkIlqVam3MN1cOgRcE28y5AUQaJuM6uMWiesmipc62bjBm+2VK09a6HZ+MQApBZTel1RoXGoG1OOk0pLcKLvXw3T9rEEO4gy2Rph29e/jIJ5JOrqbLA5kDc7FgU8FWzJzdXI/M/qqzbWCPn257pokfx8hnELfNPr+Uyf2HfKSZmjwez7XbLuA/oQnJhhywgif3VFGfHY1l2tEQedRoutOJAgHjnGZS57McZKrOWEs/bXH6haCo5N2OcAMSl0sUNT5zpJUtVd8QaSl+LD3Dlw3/MPop/66awJLn5J5ERIB6VEJx0ao7OKA55ILKbmYmdUbn0rNVOf3HhTUz3G/BGtxMxt/C4JWzrS8WlejAXnnG3TB5iS27n3rew43M1Ny42K3d/nP/8CFu1yHBPx5/EvqXEU+NPLHeBNxZdYhqBxEpWeqwGxizQ= 16 | before_install: 17 | - svn checkout https://github.com/SeleniumHQ/selenium/trunk/common/src/web 18 | - docker run -d -p 3000:8080 --name http-server -v $(pwd)/web:/public redsadic/docker-http-server& 19 | - docker run -d -p 127.0.0.1:4444:4444 --link http-server selenium/standalone-chrome:2.53.1 20 | r: 21 | - oldrel 22 | - release 23 | - devel 24 | after_success: 25 | - Rscript -e 'covr::codecov(line_exclusions = list("R/zzz.R", "R/oldMethods.R"))' 26 | - git log -n 1 --format=%B | grep -iq "SAUCETESTUPDATE"; if [ $? -eq 0 ]; then echo 27 | "Updating SauceLab browser tests"; Rscript -e 'library(seleniumPipes); source(file.path(find.package("seleniumPipes"), "Saucetests", "runtest.R"))'; fi 28 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: seleniumPipes 2 | Type: Package 3 | Title: R Client Implementing the W3C WebDriver Specification 4 | Version: 0.3.9 5 | Description: The W3C WebDriver specification defines a way for 6 | out-of-process 7 | programs to remotely instruct the behaviour of web browsers. It is 8 | detailed at . 9 | This package provides an R client implementing the W3C specification. 10 | Authors@R: c( person("John", "Harrison", , "johndharrison0@gmail.com", 11 | role = c("aut", "cre"))) 12 | Depends: 13 | R (>= 3.0.0) 14 | Imports: 15 | httr,jsonlite,xml2,magrittr,whisker 16 | Encoding: UTF-8 17 | License: GPL-3 18 | Suggests: 19 | knitr, 20 | rmarkdown, 21 | data.table, 22 | testthat, 23 | covr, 24 | RSauceLabs 25 | RoxygenNote: 5.0.1 26 | URL: https://github.com/johndharrison/seleniumPipes 27 | URLNote: https://github.com/johndharrison/seleniumPipes 28 | BugReports: https://github.com/johndharrison/seleniumPipes/issues 29 | VignetteBuilder: knitr 30 | LazyData: true 31 | -------------------------------------------------------------------------------- /NAMESPACE: -------------------------------------------------------------------------------- 1 | # Generated by roxygen2: do not edit by hand 2 | 3 | S3method(print,rDriver) 4 | S3method(print,wElement) 5 | export("%>%") 6 | export(acceptAlert) 7 | export(acceptAlertOld) 8 | export(addCookie) 9 | export(back) 10 | export(checkResponse) 11 | export(closeWindow) 12 | export(deleteAllCookies) 13 | export(deleteCookie) 14 | export(deleteSession) 15 | export(dismissAlert) 16 | export(dismissAlertOld) 17 | export(elementClear) 18 | export(elementClick) 19 | export(elementSendKeys) 20 | export(errorContent) 21 | export(errorResponse) 22 | export(executeAsyncScript) 23 | export(executeAsyncScriptOld) 24 | export(executeScript) 25 | export(executeScriptOld) 26 | export(findElement) 27 | export(findElementFromElement) 28 | export(findElements) 29 | export(findElementsFromElement) 30 | export(forward) 31 | export(fullscreenWindow) 32 | export(getActiveElement) 33 | export(getAlertText) 34 | export(getAlertTextOld) 35 | export(getAllCookies) 36 | export(getCurrentUrl) 37 | export(getElementAttribute) 38 | export(getElementCssValue) 39 | export(getElementProperty) 40 | export(getElementRect) 41 | export(getElementTagName) 42 | export(getElementText) 43 | export(getNamedCookie) 44 | export(getPageSource) 45 | export(getTimeouts) 46 | export(getTitle) 47 | export(getWindowHandle) 48 | export(getWindowHandleOld) 49 | export(getWindowHandles) 50 | export(getWindowHandlesOld) 51 | export(getWindowPosition) 52 | export(getWindowPositionOld) 53 | export(getWindowSize) 54 | export(getWindowSizeOld) 55 | export(go) 56 | export(isElementEnabled) 57 | export(isElementSelected) 58 | export(maximizeWindow) 59 | export(maximizeWindowOld) 60 | export(newSession) 61 | export(performActions) 62 | export(queryDriver) 63 | export(refresh) 64 | export(releasingActions) 65 | export(remoteDr) 66 | export(selKeys) 67 | export(sendAlertText) 68 | export(sendAlertTextOld) 69 | export(setTimeouts) 70 | export(setWindowPosition) 71 | export(setWindowPositionOld) 72 | export(setWindowSize) 73 | export(setWindowSizeOld) 74 | export(status) 75 | export(switchToFrame) 76 | export(switchToParentFrame) 77 | export(switchToWindow) 78 | export(takeElementScreenshot) 79 | export(takeScreenshot) 80 | export(wbElement) 81 | importFrom(httr,DELETE) 82 | importFrom(httr,GET) 83 | importFrom(httr,POST) 84 | importFrom(httr,build_url) 85 | importFrom(httr,content) 86 | importFrom(httr,message_for_status) 87 | importFrom(httr,parse_url) 88 | importFrom(jsonlite,base64_dec) 89 | importFrom(jsonlite,fromJSON) 90 | importFrom(jsonlite,toJSON) 91 | importFrom(magrittr,"%>%") 92 | importFrom(whisker,whisker.render) 93 | importFrom(xml2,read_html) 94 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- 1 | # seleniumpipes 0.3.9 2 | * statusCodes in checkResponse moved to internal data 3 | * Add status and getTimeouts to session group of functions. 4 | * setTimeout is renamed to setTimeouts 5 | 6 | # seleniumpipes 0.3.8 7 | * Remove cat calls from error messages. Replace with message 8 | * Switch Depend arguments to Imports in DESCRIPTION 9 | * Add ellipsis argument to pass to newSession in remoteDr function. 10 | 11 | # seleniumpipes 0.3.7 12 | * Set CRAN URL's in canonical form 13 | 14 | # seleniumpipes 0.3.6 15 | * Move testing to version 2.53.1 16 | * Update basic operation vignette 17 | 18 | # seleniumpipes 0.3.5 19 | * suggests RSauceLabs for polling SauceLabs.com API now on CRAN 20 | 21 | # seleniumpipes 0.3.4 22 | * Add sauceLabs test to travis 23 | 24 | # seleniumpipes 0.3.3 25 | * Fix issue with maximiseWindow 26 | * Add further tests and increase test coverage 27 | 28 | # seleniumpipes 0.3.2 29 | * Fix issue with switchToParentFrame 30 | * Add further tests and increase test coverage 31 | 32 | # seleniumpipes 0.3.1 33 | * Add testing on Travis and testing locally using Docker containers 34 | 35 | # seleniumpipes 0.3.0 36 | * Initial release to CRAN 37 | 38 | # seleniumpipes 0.2.7 39 | * A vignette on basic operation has been added 40 | * The retry argument can now be passed in all functions and is detailed at ?retry 41 | 42 | # seleniumpipes 0.2.6 43 | * Complete documentation of package fuinctions. 44 | * The option to retry failing calls to endpoints on the remote server has been added 45 | 46 | # seleniumpipes 0.2.5 47 | * Add documentation for initial functions. 48 | * Add documentation for cookie group of functions. 49 | * Move documentation to templates. 50 | 51 | # seleniumpipes 0.2.4 52 | * Add support for multiple sessions 53 | 54 | # seleniumpipes 0.2.3 55 | * Add tests on the API in the tests directory. (inst/tests pre-install as Selenium Server needed) 56 | -------------------------------------------------------------------------------- /R/cookies.R: -------------------------------------------------------------------------------- 1 | 2 | #' @rdname addCookie 3 | addCookie <- function(remDr, name, value, path = NULL, domain = NULL, 4 | secure = FALSE, httpOnly = NULL, expiry = NULL, ...){ 5 | obj <- remDr 6 | obj$sessionId <- remDr$sessionId(remDr$drvID) 7 | 8 | cookie <- list(name = name, value = value, path = path, domain = domain, 9 | secure = secure, httpOnly = httpOnly, expiry = expiry) 10 | cookie <- cookie[!vapply(cookie, is.null, logical(1))] 11 | jsonBody <- toJSON(list(cookie = cookie), null = "null", 12 | auto_unbox = TRUE) 13 | pathTemplate <- 14 | whisker.render("/session/{{sessionId}}/cookie", data = obj) 15 | pathURL <- remDr[['remServAdd']] 16 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 17 | res <- queryDriver(verb = POST, url = build_url(pathURL), 18 | source = "addCookie", 19 | drvID = remDr$drvID, json = jsonBody, ...) 20 | invisible(remDr) 21 | } 22 | 23 | #' @rdname deleteAllCookies 24 | deleteAllCookies <- function(remDr, ...){ 25 | obj <- remDr 26 | obj$sessionId <- remDr$sessionId(remDr$drvID) 27 | 28 | pathTemplate <- 29 | whisker.render("/session/{{sessionId}}/cookie", data = obj) 30 | pathURL <- remDr[['remServAdd']] 31 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 32 | res <- queryDriver(verb = DELETE, url = build_url(pathURL), 33 | source = "deleteAllCookies", 34 | drvID = remDr$drvID, json = NULL, ...) 35 | invisible(remDr) 36 | } 37 | 38 | #' @rdname deleteCookie 39 | deleteCookie <- function(remDr, name = NULL, ...){ 40 | obj <- remDr 41 | obj$sessionId <- remDr$sessionId(remDr$drvID) 42 | obj$name <- name 43 | pathTemplate <- 44 | whisker.render("/session/{{sessionId}}/cookie/{{name}}", data = obj) 45 | pathURL <- remDr[['remServAdd']] 46 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 47 | res <- queryDriver(verb = DELETE, url = build_url(pathURL), 48 | source = "deleteCookie", 49 | drvID = remDr$drvID, json = NULL, ...) 50 | invisible(remDr) 51 | } 52 | 53 | #' @rdname getAllCookies 54 | getAllCookies <- function(remDr, ...){ 55 | obj <- remDr 56 | obj$sessionId <- remDr$sessionId(remDr$drvID) 57 | 58 | pathTemplate <- 59 | whisker.render("/session/{{sessionId}}/cookie", data = obj) 60 | pathURL <- remDr[['remServAdd']] 61 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 62 | res <- queryDriver(verb = GET, url = build_url(pathURL), 63 | source = "getAllCookies", 64 | drvID = remDr$drvID, json = NULL, ...) 65 | res$value 66 | } 67 | 68 | #' @rdname getNamedCookie 69 | getNamedCookie <- function(remDr, name = NULL, ...){ 70 | obj <- remDr 71 | obj$sessionId <- remDr$sessionId(remDr$drvID) 72 | obj$name <- name 73 | pathTemplate <- 74 | whisker.render("/session/{{sessionId}}/cookie/{{name}}", data = obj) 75 | pathURL <- remDr[['remServAdd']] 76 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 77 | res <- queryDriver(verb = GET, url = build_url(pathURL), 78 | source = "getNamedCookie", 79 | drvID = remDr$drvID, json = NULL, ...) 80 | res$value 81 | } 82 | 83 | -------------------------------------------------------------------------------- /R/cookiesDoc.R: -------------------------------------------------------------------------------- 1 | #' Add a specific cookie. 2 | #' 3 | #'\code{addCookie} Add a specific cookie. 4 | #' 5 | #' @template remDr 6 | #' @param name character: The name of the cookie; may not be null or an 7 | #' empty string 8 | #' @param value character: The cookie value; may not be null. 9 | #' @param path character: The path the cookie is visible to. If left blank 10 | #' or set to null, will be set to "/". 11 | #' @param domain character: The domain the cookie is visible to. It should 12 | #' be null or the same as the domain of the current URL. 13 | #' @param secure logical: Whether this cookie requires a secure 14 | #' connection(https?). It should be null or equal to the security of 15 | #' the current URL. 16 | #' @param httpOnly logical: Whether the cookie is an httpOnly cookie. 17 | #' @param expiry The cookie's expiration date; may be null. 18 | #' @template ellipsis 19 | #' @export 20 | #' 21 | #' @family cookies functions 22 | #' @template ret1 23 | #' 24 | #' @example /inst/examples/docs/cookies.R 25 | #' @name addCookie 26 | NULL 27 | 28 | #' Delete all the cookies. 29 | #' 30 | #'\code{deleteAllCookies} Delete all the cookies that are currently 31 | #' visible. 32 | #' 33 | #' @template remDr 34 | #' @template ellipsis 35 | #' @export 36 | #' 37 | #' @family cookies functions 38 | #' @template ret1 39 | #' 40 | #' @example /inst/examples/docs/cookies.R 41 | #' @name deleteAllCookies 42 | NULL 43 | 44 | #' Delete a given cookie. 45 | #' 46 | #'\code{deleteCookie} Delete the cookie with the give name. 47 | #' 48 | #' @template remDr 49 | #' @param name character: The name of the cookie; may not be null or an 50 | #' empty string 51 | #' @template ellipsis 52 | #' @export 53 | #' 54 | #' @family cookies functions 55 | #' @template ret1 56 | #' 57 | #' @example /inst/examples/docs/cookies.R 58 | #' @name deleteCookie 59 | NULL 60 | 61 | #' Get all current domain cookies 62 | #' 63 | #'\code{getAllCookies} Get all the cookies for the current domain. 64 | #' 65 | #' @template remDr 66 | #' @template ellipsis 67 | #' @export 68 | #' 69 | #' @family cookies functions 70 | #' @return A list of all the cookies on the current domain are returned. 71 | #' These cookies have values as stipulated by the arguments given in 72 | #' \code{\link{addCookie}}. 73 | #' 74 | #' @example /inst/examples/docs/cookies.R 75 | #' @name getAllCookies 76 | NULL 77 | 78 | #' Get a named cookie 79 | #' 80 | #'\code{getNamedCookie} Get the cookie with a given name. 81 | #' 82 | #' @template remDr 83 | #' @param name character: The name of the cookie; may not be null or an 84 | #' empty string 85 | #' @template ellipsis 86 | #' @export 87 | #' 88 | #' @family cookies functions 89 | #' @return A named cookies from the current domain is returned if it 90 | #' exists. These cookies have values as stipulated by the arguments 91 | #' given in \code{\link{addCookie}}. 92 | #' 93 | #' @example /inst/examples/docs/cookies.R 94 | #' @name getNamedCookie 95 | NULL 96 | 97 | 98 | -------------------------------------------------------------------------------- /R/documentHandling.R: -------------------------------------------------------------------------------- 1 | 2 | #' @rdname executeAsyncScript 3 | executeAsyncScript <- function(remDr, script, args = list(), 4 | replace = TRUE, ...){ 5 | obj <- remDr 6 | obj$sessionId <- remDr$sessionId(remDr$drvID) 7 | 8 | args <- lapply(args, function(x){ 9 | if('wElement' %in% class(x)){ 10 | x$elementId 11 | }else{ 12 | x 13 | } 14 | }) 15 | jsonBody <- toJSON(list( 16 | script = script, args = args 17 | ), auto_unbox = TRUE) 18 | 19 | pathTemplate <- 20 | whisker.render("/session/{{sessionId}}/execute/async", data = obj) 21 | pathURL <- remDr[['remServAdd']] 22 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 23 | res <- queryDriver(verb = POST, url = build_url(pathURL), 24 | source = "executeAsyncScript", 25 | drvID = remDr$drvID, json = jsonBody,...) 26 | if(replace){testWebElement(res$value, remDr)}else{res$value} 27 | } 28 | 29 | #' @rdname executeScript 30 | executeScript <- function(remDr, script, args = list(), 31 | replace = TRUE, ...){ 32 | obj <- remDr 33 | obj$sessionId <- remDr$sessionId(remDr$drvID) 34 | 35 | args <- lapply(args, function(x){ 36 | if('wElement' %in% class(x)){ 37 | x$elementId 38 | }else{ 39 | x 40 | } 41 | }) 42 | jsonBody <- toJSON(list( 43 | script = script, args = args 44 | ), auto_unbox = TRUE) 45 | 46 | pathTemplate <- 47 | whisker.render("/session/{{sessionId}}/execute/sync", data = obj) 48 | pathURL <- remDr[['remServAdd']] 49 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 50 | res <- queryDriver(verb = POST, url = build_url(pathURL), 51 | source = "executeScript", 52 | drvID = remDr$drvID, json = jsonBody,...) 53 | if(replace){testWebElement(res$value, remDr)}else{res$value} 54 | } 55 | 56 | #' @rdname getPageSource 57 | getPageSource <- function(remDr, ...){ 58 | obj <- remDr 59 | obj$sessionId <- remDr$sessionId(remDr$drvID) 60 | 61 | pathTemplate <- 62 | whisker.render("/session/{{sessionId}}/source", data = obj) 63 | pathURL <- remDr[['remServAdd']] 64 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 65 | res <- queryDriver(verb = GET, url = build_url(pathURL), 66 | source = "getPageSource", 67 | drvID = remDr$drvID, json = NULL,...) 68 | read_html(res$value) 69 | } 70 | 71 | -------------------------------------------------------------------------------- /R/documentHandlingDoc.R: -------------------------------------------------------------------------------- 1 | #' Execute JavaScript asynchronously on browser. 2 | #' 3 | #'\code{executeAsyncScript} Inject a snippet of JavaScript into the page 4 | #' for asynchronous execution in the context of the currently selected 5 | #' frame. 6 | #' 7 | #' The driver will pass a callback as the last argument to the snippet, 8 | #' and block until the callback is invoked. 9 | #' 10 | #' @template remDr 11 | #' @param script character: The script to inject. 12 | #' @param args The arguments of the script as a list. 13 | #' @param replace logical: If TRUE any elements identify as web Elements 14 | #' are converted to such. 15 | #' @template ellipsis 16 | #' 17 | #' @family documentHandling functions 18 | #' @template ret6 19 | #' @export 20 | #' 21 | #' @example /inst/examples/docs/documentHandling.R 22 | #' @name executeAsyncScript 23 | NULL 24 | 25 | #' Execute JavaScript on browser. 26 | #' 27 | #'\code{executeScript} Inject a snippet of JavaScript into the page for 28 | #' execution in the context of the currently selected frame. The 29 | #' executed script is assumed to be synchronous and the result of 30 | #' evaluating the script will be returned. 31 | #' 32 | #' @template remDr 33 | #' @param script character: The script to inject. 34 | #' @param args The arguments of the script as a list. 35 | #' @param replace logical: If TRUE any elements identify as web Elements 36 | #' are converted to such. 37 | #' @template ellipsis 38 | #' 39 | #' @family documentHandling functions 40 | #' @template ret6 41 | #' @export 42 | #' 43 | #' @example /inst/examples/docs/documentHandling.R 44 | #' @name executeScript 45 | NULL 46 | 47 | #' Get source of last page. 48 | #' 49 | #'\code{getPageSource} Get the source of the last loaded page. 50 | #' 51 | #' @template remDr 52 | #' @template ellipsis 53 | #' 54 | #' @family documentHandling functions 55 | #' @template ret3 56 | #' @export 57 | #' 58 | #' @example /inst/examples/docs/documentHandling.R 59 | #' @name getPageSource 60 | NULL 61 | 62 | 63 | -------------------------------------------------------------------------------- /R/elementInteraction.R: -------------------------------------------------------------------------------- 1 | 2 | #' @rdname elementClear 3 | elementClear <- function(webElem, ...){ 4 | obj <- webElem 5 | obj$sessionId <- webElem$sessionId(webElem$remDr$drvID) 6 | obj$elementId <- webElem$elementId$ELEMENT 7 | jsonBody <- NULL 8 | pathTemplate <- 9 | whisker.render("/session/{{sessionId}}/element/{{elementId}}/clear", 10 | data = obj) 11 | pathURL <- webElem[['remDr']][['remServAdd']] 12 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 13 | res <- queryDriver(verb = POST, url = build_url(pathURL), 14 | source = "elementClear", drvID = webElem$remDr$drvID, 15 | json = jsonBody,...) 16 | invisible(webElem) 17 | } 18 | 19 | 20 | 21 | #' @rdname elementClick 22 | elementClick <- function(webElem, ...){ 23 | obj <- webElem 24 | obj$sessionId <- webElem$sessionId(webElem$remDr$drvID) 25 | obj$elementId <- webElem$elementId$ELEMENT 26 | jsonBody <- NULL 27 | pathTemplate <- 28 | whisker.render("/session/{{sessionId}}/element/{{elementId}}/click", 29 | data = obj) 30 | pathURL <- webElem[['remDr']][['remServAdd']] 31 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 32 | res <- queryDriver(verb = POST, url = build_url(pathURL), 33 | source = "elementClick", drvID = webElem$remDr$drvID, 34 | json = jsonBody,...) 35 | invisible(webElem) 36 | } 37 | 38 | 39 | 40 | #' @rdname elementSendKeys 41 | elementSendKeys <- function(webElem, ...){ 42 | obj <- webElem 43 | obj$sessionId <- webElem$sessionId(webElem$remDr$drvID) 44 | obj$elementId <- webElem$elementId$ELEMENT 45 | sendKeys <- list(...) 46 | jsonBody <- toJSON(list(value = matchSelKeys(sendKeys)), 47 | auto_unbox = TRUE) 48 | pathTemplate <- 49 | whisker.render("/session/{{sessionId}}/element/{{elementId}}/value", 50 | data = obj) 51 | pathURL <- webElem[['remDr']][['remServAdd']] 52 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 53 | res <- queryDriver(verb = POST, url = build_url(pathURL), 54 | source = "elementSendKeys", 55 | drvID = webElem$remDr$drvID, 56 | json = jsonBody,...) 57 | invisible(webElem) 58 | } 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /R/elementInteractionDoc.R: -------------------------------------------------------------------------------- 1 | #' Clear an elements text value. 2 | #' 3 | #'\code{elementClear} Clear a TEXTAREA or text INPUT element's value. 4 | #' 5 | #' @template webElem 6 | #' @template ellipsis 7 | #' 8 | #' @family elementInteraction functions 9 | #' @template ret7 10 | #' @export 11 | #' 12 | #' @example /inst/examples/docs/elementInteraction.R 13 | #' @name elementClear 14 | NULL 15 | 16 | #' Click on an element. 17 | #' 18 | #'\code{elementClick} The elementClick function scrolls into view the 19 | #' element and clicks the in-view centre point. If the element is not 20 | #' pointer-interactable, an element not interactable error is returned. 21 | #' 22 | #' @template webElem 23 | #' @template ellipsis 24 | #' 25 | #' @family elementInteraction functions 26 | #' @template ret7 27 | #' @export 28 | #' 29 | #' @example /inst/examples/docs/elementInteraction.R 30 | #' @name elementClick 31 | NULL 32 | 33 | #' Send a sequence of key strokes to an element. 34 | #' 35 | #'\code{elementSendKeys} The elementSendKeys function scrolls into view 36 | #' the form control element and then sends the provided keys to the 37 | #' element. In case the element is not keyboard interactable, an 38 | #' element not interactable error is returned. 39 | #' 40 | #' @template webElem 41 | #' @param ... keys to send the element. \code{seleniumPipes} includes 42 | #' mappings to unicode keys see \code{\link{selKeys}}. To use one of 43 | #' this name the string using key. See examples. 44 | #' 45 | #' @family elementInteraction functions 46 | #' @template ret7 47 | #' @export 48 | #' 49 | #' @example /inst/examples/docs/elementInteraction.R 50 | #' @name elementSendKeys 51 | NULL 52 | 53 | 54 | -------------------------------------------------------------------------------- /R/interactions.R: -------------------------------------------------------------------------------- 1 | 2 | #' @rdname performActions 3 | performActions <- function(remDr, ...){ 4 | obj <- remDr 5 | obj$sessionId <- remDr$sessionId(remDr$drvID) 6 | 7 | # Add function specific JSON to post 8 | jsonBody <- toJSON(list( 9 | 10 | ), auto_unbox = TRUE) 11 | 12 | pathTemplate <- 13 | whisker.render("/session/{{sessionId}}/actions", data = obj) 14 | pathURL <- remDr[['remServAdd']] 15 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 16 | res <- queryDriver(verb = POST, url = build_url(pathURL), 17 | source = "performActions", 18 | drvID = remDr$drvID, json = jsonBody,...) 19 | invisible(remDr) 20 | } 21 | 22 | #' @rdname releasingActions 23 | releasingActions <- function(remDr, ...){ 24 | obj <- remDr 25 | obj$sessionId <- remDr$sessionId(remDr$drvID) 26 | 27 | pathTemplate <- 28 | whisker.render("/session/{{sessionId}}/actions", data = obj) 29 | pathURL <- remDr[['remServAdd']] 30 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 31 | res <- queryDriver(verb = DELETE, url = build_url(pathURL), 32 | source = "releasingActions", 33 | drvID = remDr$drvID, json = NULL,...) 34 | invisible(remDr) 35 | } 36 | 37 | -------------------------------------------------------------------------------- /R/interactionsDoc.R: -------------------------------------------------------------------------------- 1 | #' Not currently implemented 2 | #' 3 | #'\code{performActions} The Perform Actions command allows you to create 4 | #' sequential interactions that can be sent over from the local end to 5 | #' the remote end. This type of interactions allow emulations like drag 6 | #' and drop. 7 | #' 8 | #' @template remDr 9 | #' @template ellipsis 10 | #' 11 | #' @family interactions functions 12 | #' @template ret1 13 | #' @export 14 | #' 15 | #' @example /inst/examples/docs/interactions.R 16 | #' @name performActions 17 | NULL 18 | 19 | #' Not currently implemented 20 | #' 21 | #'\code{releasingActions} The Release Actions command is used to cancel 22 | #' all current action chains. This is the equivalent of releasing all 23 | #' modifiers from input sources. 24 | #' 25 | #' @template remDr 26 | #' @template ellipsis 27 | #' 28 | #' @family interactions functions 29 | #' @template ret1 30 | #' @export 31 | #' 32 | #' @example /inst/examples/docs/interactions.R 33 | #' @name releasingActions 34 | NULL 35 | 36 | 37 | -------------------------------------------------------------------------------- /R/navigationDoc.R: -------------------------------------------------------------------------------- 1 | #' Navigate backwards 2 | #' 3 | #'\code{back} Navigate backwards in the browser history, if possible. 4 | #' 5 | #' @template remDr 6 | #' @template ellipsis 7 | #' 8 | #' @family navigation functions 9 | #' @template ret1 10 | #' @export 11 | #' 12 | #' @example /inst/examples/docs/navigation.R 13 | #' @name back 14 | NULL 15 | 16 | #' Navigate forwards 17 | #' 18 | #'\code{forward} Navigate forwards in the browser history, if possible. 19 | #' 20 | #' @template remDr 21 | #' @template ellipsis 22 | #' 23 | #' @family navigation functions 24 | #' @template ret1 25 | #' @export 26 | #' 27 | #' @example /inst/examples/docs/navigation.R 28 | #' @name forward 29 | NULL 30 | 31 | #' Retrieve the URL of the current page. 32 | #' 33 | #'\code{getCurrentUrl} Retrieve the URL of the current page. 34 | #' 35 | #' @template remDr 36 | #' @template ellipsis 37 | #' 38 | #' @family navigation functions 39 | #' @return A character string is returned giving the current page URL. 40 | #' @export 41 | #' 42 | #' @example /inst/examples/docs/navigation.R 43 | #' @name getCurrentUrl 44 | NULL 45 | 46 | #' Get the current page title. 47 | #' 48 | #'\code{getTitle} Get the current page title. 49 | #' 50 | #' @template remDr 51 | #' @template ellipsis 52 | #' 53 | #' @family navigation functions 54 | #' @return The title of the current page is returned as a character string. 55 | #' @export 56 | #' 57 | #' @example /inst/examples/docs/navigation.R 58 | #' @name getTitle 59 | NULL 60 | 61 | #' Navigate to a new URL. 62 | #' 63 | #'\code{go} Navigate to a new URL. 64 | #' @template ellipsis 65 | #' 66 | #' @template remDr 67 | #' @param url The URL to navigate to. 68 | #' 69 | #' @family navigation functions 70 | #' @template ret1 71 | #' @export 72 | #' 73 | #' @example /inst/examples/docs/navigation.R 74 | #' @name go 75 | NULL 76 | 77 | #' Refresh the current page. 78 | #' 79 | #'\code{refresh} Refresh the current page. 80 | #' 81 | #' @template remDr 82 | #' @template ellipsis 83 | #' 84 | #' @family navigation functions 85 | #' @template ret1 86 | #' @export 87 | #' 88 | #' @example /inst/examples/docs/navigation.R 89 | #' @name refresh 90 | NULL 91 | 92 | 93 | -------------------------------------------------------------------------------- /R/screenCapture.R: -------------------------------------------------------------------------------- 1 | 2 | #' @rdname takeElementScreenshot 3 | takeElementScreenshot <- 4 | function(webElem, file = NULL, 5 | display = getOption("seleniumPipes_display_screenshot"), 6 | useViewer = !is.null(getOption("viewer")), returnPNG = FALSE, 7 | ...){ 8 | obj <- webElem 9 | obj$sessionId <- webElem$sessionId(webElem$remDr$drvID) 10 | obj$elementId <- webElem$elementId$ELEMENT 11 | 12 | pT <- "/session/{{sessionId}}/element/{{elementId}}/screenshot" 13 | pathTemplate <- whisker.render(pT, data = obj) 14 | pathURL <- webElem[['remDr']][['remServAdd']] 15 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 16 | res <- queryDriver(verb = GET, url = build_url(pathURL), 17 | source = "takeElementScreenshot", drvID = webElem$remDr$drvID, 18 | json = NULL,...) 19 | b64png <- base64_dec(res$value) 20 | if(display){ 21 | tmp <- file.path(tempdir(), 'tmpElementScreenShot.png') 22 | writeBin(b64png, tmp) 23 | viewer <- getOption("viewer") 24 | if (useViewer){ 25 | viewer(tmp) 26 | }else{ 27 | utils::browseURL(tmp) 28 | } 29 | } 30 | if(!is.null(file)){ 31 | writeBin(b64png, file) 32 | } 33 | if(returnPNG){ 34 | b64png 35 | }else{ 36 | invisible(webElem) 37 | } 38 | 39 | } 40 | 41 | 42 | 43 | #' @rdname takeScreenshot 44 | takeScreenshot <- 45 | function(remDr, file = NULL, 46 | display = getOption("seleniumPipes_display_screenshot"), 47 | useViewer = !is.null(getOption("viewer")), returnPNG = FALSE, 48 | ...){ 49 | obj <- remDr 50 | obj$sessionId <- remDr$sessionId(remDr$drvID) 51 | 52 | pathTemplate <- 53 | whisker.render("/session/{{sessionId}}/screenshot", data = obj) 54 | pathURL <- remDr[['remServAdd']] 55 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 56 | res <- queryDriver(verb = GET, url = build_url(pathURL), 57 | source = "takeScreenshot", 58 | drvID = remDr$drvID, json = NULL,...) 59 | b64png <- base64_dec(res$value) 60 | if(display){ 61 | tmp <- file.path(tempdir(), 'tmpScreenShot.png') 62 | writeBin(b64png, tmp) 63 | viewer <- getOption("viewer") 64 | if (useViewer){ 65 | viewer(tmp) 66 | }else{ 67 | utils::browseURL(tmp) 68 | } 69 | } 70 | if(!is.null(file)){ 71 | writeBin(b64png, file) 72 | } 73 | if(returnPNG){ 74 | b64png 75 | }else{ 76 | invisible(remDr) 77 | } 78 | 79 | } 80 | 81 | -------------------------------------------------------------------------------- /R/screenCaptureDoc.R: -------------------------------------------------------------------------------- 1 | #' takeElementScreenshot 2 | #' 3 | #'\code{takeElementScreenshot} 4 | #' 5 | #' @template webElem 6 | #' @param file If not null the decoded PNG is written to file using the 7 | #' string provided here. Defaults to NULL. 8 | #' @param display logical Display the PNG or not (default is set in 9 | #' getOption("seleniumPipes_display_screenshot")). 10 | #' @param useViewer A viewer to view the PNG. Looks for the RSudio viewer 11 | #' by default. 12 | #' @param returnPNG logical return the decoded PNG. If false (default) 13 | #' webElem is returned to allow chaining. 14 | #' @template ellipsis 15 | #' 16 | #' @family screenCapture functions 17 | #' @template ret13 18 | #' @export 19 | #' 20 | #' @example /inst/examples/docs/screenCapture.R 21 | #' @name takeElementScreenshot 22 | NULL 23 | 24 | #' takeScreenshot 25 | #' 26 | #'\code{takeScreenshot} 27 | #' 28 | #' @template remDr 29 | #' @param file If not null the decoded PNG is written to file using the 30 | #' string provided here. Defaults to NULL. 31 | #' @param display logical Display the PNG or not (default is set in 32 | #' getOption("seleniumPipes_display_screenshot")). 33 | #' @param useViewer A viewer to view the PNG. Looks for the RSudio viewer 34 | #' by default. 35 | #' @param returnPNG logical return the decoded PNG. If false (default) 36 | #' remDr is returned to allow chaining. 37 | #' @template ellipsis 38 | #' 39 | #' @family screenCapture functions 40 | #' @template ret12 41 | #' @export 42 | #' 43 | #' @example /inst/examples/docs/screenCapture.R 44 | #' @name takeScreenshot 45 | NULL 46 | 47 | 48 | -------------------------------------------------------------------------------- /R/sessions.R: -------------------------------------------------------------------------------- 1 | 2 | #' @rdname deleteSession 3 | deleteSession <- function(remDr, ...){ 4 | obj <- remDr 5 | obj$sessionId <- remDr$sessionId(remDr$drvID) 6 | 7 | pathTemplate <- 8 | whisker.render("/session/{{sessionId}}", data = obj) 9 | pathURL <- remDr[['remServAdd']] 10 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 11 | res <- queryDriver(verb = DELETE, url = build_url(pathURL), 12 | source = "deleteSession", 13 | drvID = remDr$drvID, json = NULL,...) 14 | .e$sessionId[[remDr$drvID]] <- NULL;invisible(remDr) 15 | } 16 | 17 | #' @rdname getTimeouts 18 | getTimeouts <- function(remDr, type = "page load", ...){ 19 | obj <- remDr 20 | obj$sessionId <- remDr$sessionId(remDr$drvID) 21 | 22 | jsonBody <- toJSON(list(type = type), 23 | auto_unbox = TRUE) 24 | pathTemplate <- 25 | whisker.render("/session/{{sessionId}}/timeouts", data = obj) 26 | pathURL <- remDr[['remServAdd']] 27 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 28 | res <- queryDriver(verb = GET, url = build_url(pathURL), 29 | source = "getTimeouts", 30 | drvID = remDr$drvID, json = NULL,...) 31 | res$value 32 | } 33 | 34 | #' @rdname newSession 35 | newSession <- function(remDr, ...){ 36 | obj <- remDr 37 | obj$sessionId <- remDr$sessionId(remDr$drvID) 38 | 39 | # Add function specific JSON to post 40 | jsonBody <- toJSON(list( 41 | desiredCapabilities =c(remDr$desiredCapabilities, 42 | remDr$extraCapabilities) 43 | ), auto_unbox = TRUE) 44 | 45 | pathTemplate <- 46 | whisker.render("/session", data = obj) 47 | pathURL <- remDr[['remServAdd']] 48 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 49 | res <- queryDriver(verb = POST, url = build_url(pathURL), 50 | source = "newSession", 51 | drvID = remDr$drvID, json = jsonBody,...) 52 | remDr$sessionInfo <- res$value;invisible(remDr) 53 | } 54 | 55 | #' @rdname setTimeouts 56 | setTimeouts <- function(remDr, type = "page load", milliseconds = 10000, 57 | ...){ 58 | obj <- remDr 59 | obj$sessionId <- remDr$sessionId(remDr$drvID) 60 | 61 | jsonBody <- toJSON(list(type = type, ms = milliseconds), 62 | auto_unbox = TRUE) 63 | pathTemplate <- 64 | whisker.render("/session/{{sessionId}}/timeouts", data = obj) 65 | pathURL <- remDr[['remServAdd']] 66 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 67 | res <- queryDriver(verb = POST, url = build_url(pathURL), 68 | source = "setTimeouts", 69 | drvID = remDr$drvID, json = jsonBody,...) 70 | invisible(remDr) 71 | } 72 | 73 | #' @rdname status 74 | status <- function(remDr, ...){ 75 | obj <- remDr 76 | obj$sessionId <- remDr$sessionId(remDr$drvID) 77 | 78 | pathTemplate <- 79 | whisker.render("/status", data = obj) 80 | pathURL <- remDr[['remServAdd']] 81 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 82 | res <- queryDriver(verb = GET, url = build_url(pathURL), 83 | source = "status", 84 | drvID = remDr$drvID, json = NULL,...) 85 | res$value 86 | } 87 | 88 | -------------------------------------------------------------------------------- /R/sessionsDoc.R: -------------------------------------------------------------------------------- 1 | #' Delete the session. 2 | #' 3 | #'\code{deleteSession} Delete the session. 4 | #' 5 | #' @template remDr 6 | #' @template ellipsis 7 | #' 8 | #' @family sessions functions 9 | #' @template ret9 10 | #' @export 11 | #' 12 | #' @example /inst/examples/docs/sessions.R 13 | #' @name deleteSession 14 | NULL 15 | 16 | #' Create a new session. 17 | #' 18 | #'\code{newSession} The server should attempt to create a session that 19 | #' most closely matches the desired and required capabilities. Required 20 | #' capabilities have higher priority than desired capabilities and must 21 | #' be set for the session to be created. 22 | #' 23 | #' @template remDr 24 | #' @template ellipsis 25 | #' 26 | #' @family sessions functions 27 | #' @template ret8 28 | #' @export 29 | #' 30 | #' @example /inst/examples/docs/sessions.R 31 | #' @name newSession 32 | NULL 33 | 34 | #' Get amount of time that a particular type of operation can execute in. 35 | #' 36 | #'\code{getTimeouts} The Get Timeout command gets timeouts associated with 37 | #' the current session. 38 | #' 39 | #' @template remDr 40 | #' @param type The type of operation to set the timeout for. Valid values 41 | #' are: "script" for script timeouts, "implicit" for modifying the 42 | #' implicit wait timeout and "page load" for setting a page load 43 | #' timeout. 44 | #' @template ellipsis 45 | #' 46 | #' @family sessions functions 47 | #' @template ret2 48 | #' @export 49 | #' 50 | #' @example /inst/examples/docs/sessions.R 51 | #' @name getTimeouts 52 | NULL 53 | 54 | #' Configure the amount of time that a particular type of operation can 55 | #' execute 56 | #' 57 | #'\code{getTimeouts} Configure the amount of time that a particular type 58 | #' of operation can execute for before they are aborted and a |Timeout| 59 | #' error is returned to the client. 60 | #' 61 | #' @template remDr 62 | #' @param type The type of operation to set the timeout for. Valid values 63 | #' are: "script" for script timeouts, "implicit" for modifying the 64 | #' implicit wait timeout and "page load" for setting a page load 65 | #' timeout. 66 | #' @param milliseconds The amount of time, in milliseconds, that 67 | #' time-limited commands are permitted to run. 68 | #' @template ellipsis 69 | #' 70 | #' @family sessions functions 71 | #' @template ret1 72 | #' @export 73 | #' 74 | #' @example /inst/examples/docs/sessions.R 75 | #' @name setTimeouts 76 | NULL 77 | 78 | #' Get remote end status. 79 | #' 80 | #'\code{status} The Status command returns information about whether a 81 | #' remote end is in a state in which it can create a new session. 82 | #' This is represented by the ready property of the response body, 83 | #' which has a value of false if attempting to create a session at 84 | #' the current time would fail. 85 | #' 86 | #' @template remDr 87 | #' 88 | #' @family sessions functions 89 | #' @template ret2 90 | #' @template ellipsis 91 | #' @export 92 | #' 93 | #' @example /inst/examples/docs/sessions.R 94 | #' @name status 95 | NULL 96 | 97 | -------------------------------------------------------------------------------- /R/sysdata.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johndharrison/seleniumPipes/53a268dc1496af84278019213f8e556df041034a/R/sysdata.rda -------------------------------------------------------------------------------- /R/userPrompts.R: -------------------------------------------------------------------------------- 1 | 2 | #' @rdname acceptAlert 3 | acceptAlert <- function(remDr, ...){ 4 | obj <- remDr 5 | obj$sessionId <- remDr$sessionId(remDr$drvID) 6 | jsonBody <- NULL 7 | pathTemplate <- 8 | whisker.render("/session/{{sessionId}}/alert/accept", data = obj) 9 | pathURL <- remDr[['remServAdd']] 10 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 11 | res <- queryDriver(verb = POST, url = build_url(pathURL), 12 | source = "acceptAlert", 13 | drvID = remDr$drvID, json = jsonBody,...) 14 | invisible(remDr) 15 | } 16 | 17 | #' @rdname dismissAlert 18 | dismissAlert <- function(remDr, ...){ 19 | obj <- remDr 20 | obj$sessionId <- remDr$sessionId(remDr$drvID) 21 | jsonBody <- NULL 22 | pathTemplate <- 23 | whisker.render("/session/{{sessionId}}/alert/dismiss", data = obj) 24 | pathURL <- remDr[['remServAdd']] 25 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 26 | res <- queryDriver(verb = POST, url = build_url(pathURL), 27 | source = "dismissAlert", 28 | drvID = remDr$drvID, json = jsonBody,...) 29 | invisible(remDr) 30 | } 31 | 32 | #' @rdname getAlertText 33 | getAlertText <- function(remDr, ...){ 34 | obj <- remDr 35 | obj$sessionId <- remDr$sessionId(remDr$drvID) 36 | 37 | pathTemplate <- 38 | whisker.render("/session/{{sessionId}}/alert/text", data = obj) 39 | pathURL <- remDr[['remServAdd']] 40 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 41 | res <- queryDriver(verb = GET, url = build_url(pathURL), 42 | source = "getAlertText", 43 | drvID = remDr$drvID, json = NULL,...) 44 | res$value 45 | } 46 | 47 | #' @rdname sendAlertText 48 | sendAlertText <- function(remDr, text = "", ...){ 49 | obj <- remDr 50 | obj$sessionId <- remDr$sessionId(remDr$drvID) 51 | 52 | jsonBody <- toJSON(list(text = text), auto_unbox = TRUE) 53 | pathTemplate <- 54 | whisker.render("/session/{{sessionId}}/alert/text", data = obj) 55 | pathURL <- remDr[['remServAdd']] 56 | pathURL[['path']] <- paste0(pathURL[['path']], pathTemplate) 57 | res <- queryDriver(verb = POST, url = build_url(pathURL), 58 | source = "sendAlertText", 59 | drvID = remDr$drvID, json = jsonBody,...) 60 | invisible(remDr) 61 | } 62 | 63 | -------------------------------------------------------------------------------- /R/userPromptsDoc.R: -------------------------------------------------------------------------------- 1 | #' Accept alert 2 | #' 3 | #'\code{acceptAlert} accept a JavaScript alert 4 | #' 5 | #' @template remDr 6 | #' @template ellipsis 7 | #' 8 | #' @family userPrompts functions 9 | #' @template ret1 10 | #' @export 11 | #' 12 | #' @example /inst/examples/docs/userPrompts.R 13 | #' @name acceptAlert 14 | NULL 15 | 16 | #' Dismiss Alert 17 | #' 18 | #'\code{dismissAlert} dismiss a JavaScript alert 19 | #' 20 | #' @template remDr 21 | #' @template ellipsis 22 | #' 23 | #' @family userPrompts functions 24 | #' @template ret1 25 | #' @export 26 | #' 27 | #' @example /inst/examples/docs/userPrompts.R 28 | #' @name dismissAlert 29 | NULL 30 | 31 | #' Get alert text 32 | #' 33 | #'\code{getAlertText} Get the text from a JavaScript alert. 34 | #' 35 | #' @template remDr 36 | #' @template ellipsis 37 | #' 38 | #' @family userPrompts functions 39 | #' @return The text from the alert is returned. 40 | #' @export 41 | #' 42 | #' @example /inst/examples/docs/userPrompts.R 43 | #' @name getAlertText 44 | NULL 45 | 46 | #' Send text to alert 47 | #' 48 | #'\code{sendAlertText} Send keystrokes to JavaScript prompt() dialog 49 | #' 50 | #' @template remDr 51 | #' @param text A character vector of length 1. In other words a string. 52 | #' The text is passed to the JavaScript alert 53 | #' @template ellipsis 54 | #' 55 | #' @family userPrompts functions 56 | #' @template ret1 57 | #' @export 58 | #' 59 | #' @example /inst/examples/docs/userPrompts.R 60 | #' @name sendAlertText 61 | NULL 62 | 63 | 64 | -------------------------------------------------------------------------------- /docs/css/highlight.css: -------------------------------------------------------------------------------- 1 | /* Syntax highlighting ---------------------------------------------------- */ 2 | 3 | pre .input { 4 | border-left: 3px solid #ccc; 5 | padding-left: 0.5em; 6 | } 7 | pre .output { 8 | background-color: #eee; 9 | } 10 | 11 | .number {color:rgb(21,20,181);} 12 | .functioncall {color:#264D66 ;} 13 | .string {color:#375D81 ;} 14 | .keyword {font-weight:bolder ;color:black;} 15 | .argument {color:#264D66 ;} 16 | .comment {color: #4C886B;} 17 | .formalargs {color: #264D66;} 18 | .eqformalargs {color:#264D66;} 19 | .slot {font-style:italic;} 20 | .symbol {color:black ;} 21 | .prompt {color:black ;} 22 | 23 | pre img { 24 | background-color: #fff; 25 | border: 1px solid #ccc; 26 | display: block; 27 | margin: 0.5em auto 0.5em auto; 28 | } 29 | -------------------------------------------------------------------------------- /docs/css/staticdocs.css: -------------------------------------------------------------------------------- 1 | h2 {padding-top: 20px} 2 | 3 | .icon img { 4 | float: right; 5 | border: 1px solid #ccc; 6 | } 7 | .index .internal {display: none;} 8 | ul.index li {margin-bottom: 0.5em; clear: both;} 9 | 10 | footer { 11 | margin-top: 45px; 12 | padding: 35px 0 36px; 13 | border-top: 1px solid #e5e5e5; 14 | } 15 | footer p { 16 | margin-bottom: 0; 17 | color: #555; 18 | } 19 | 20 | .sidebar h2 { 21 | font-size: 1.1em; 22 | padding-top: 0.5em; 23 | } 24 | 25 | .sidebar li {margin-bottom: 0.5em;} 26 | -------------------------------------------------------------------------------- /docs/img/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johndharrison/seleniumPipes/53a268dc1496af84278019213f8e556df041034a/docs/img/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /docs/img/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johndharrison/seleniumPipes/53a268dc1496af84278019213f8e556df041034a/docs/img/glyphicons-halflings.png -------------------------------------------------------------------------------- /docs/selKeys.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | selKeys. seleniumPipes 0.3.3 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 19 | 20 | 28 | 31 | 32 | 33 | 34 | 47 | 48 | 49 |
50 |
51 | 52 |
53 | 54 |

Selenium key mappings

55 | 56 |
57 |
58 |

Usage

59 |
selKeys
60 | 61 |
62 |

Format

63 | 64 |

A named list. The names are the descriptions of the keys. The values are the "UTF-8" character representations.

65 | 66 |
67 | 68 |
69 |

Source

70 | 71 |

http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value

72 | 73 |
74 | 75 |
76 |

Description

77 | 78 |

This data set contains a list of selenium key mappings. The key mappings are outlined at 79 | https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidvalue. 80 | selKeys is used when a sendKeys variable is needed. sendKeys is defined as a list. If an entry is needed from selKeys it is denoted by key.

81 | 82 |
83 |
84 | 100 |
101 | 102 | 106 |
107 | 108 | -------------------------------------------------------------------------------- /inst/Saucetests/README.md: -------------------------------------------------------------------------------- 1 | ## seleniumPipes tests 2 | 3 | Port of the python tests in the Selenium project currently at /selenium/py/test/selenium/webdriver/commmon . The html files utilised are currently located at /selenium/common/src/web also in the selenium project. A environment variable SEL_TEST_DIR should be set on a local system to refer to the base directory containing the html files. This should be a fully qualified path. 4 | 5 | ### sauceConnect 6 | 7 | For running tests on sauceLabs it is recommended to have a local server serving the selenium test html files. The sauce labs browsers should access these files via sauceConnect. 8 | -------------------------------------------------------------------------------- /inst/Saucetests/setup.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | if(is.null(getOption("seleniumPipes_selOptions"))){ 3 | stop("Please set test options") 4 | } 5 | remDr <- do.call(remoteDr, getOption("seleniumPipes_selOptions")) 6 | if(identical(getOption("seleniumPipes_SL"), TRUE)){ 7 | options(seleniumPipes_sauceID = 8 | remDr$sessionInfo$webdriver.remote.sessionid) 9 | } 10 | # set page load timeout to 3 secs 11 | remDr %>% setTimeout(milliseconds = 10000) 12 | # wait 5 secs for elements to load 13 | remDr %>% setTimeout(type = "implicit", milliseconds = 5000) 14 | rdBrowser <- remDr$sessionInfo$browserName 15 | if(rdBrowser %in% c("iPhone", "iPad", "safari")){ 16 | htmlSrc <- "myname.local:3000" 17 | }else{ 18 | # add somethin like 127.0.0.1 myname.local to /etc/hosts or equivalent 19 | htmlSrc <- "localhost:3000" 20 | } 21 | loadPage <- function(pgStr){ 22 | paste0("http://", file.path(htmlSrc, paste0(pgStr, ".html"))) 23 | } 24 | -------------------------------------------------------------------------------- /inst/examples/dismissAlert.R: -------------------------------------------------------------------------------- 1 | remDr <- remoteDr() 2 | remDr %>% go("https://www.google.com/ncr") 3 | remDr %>% getTitle() 4 | sScript <- "setTimeout(function(){alert('HELLO')},1000); return 'DONE';" 5 | remDr %>% executeScript(sScript, args = list()) 6 | remDr %>% dismissAlert() 7 | 8 | sScript <- 9 | "setTimeout(function(){confirm('Press a button')},1000); return 'DONE';" 10 | remDr %>% executeScript(sScript, args = list()) 11 | remDr %>% acceptAlert() 12 | 13 | sScript <- 14 | "setTimeout(function(){confirm('Press a button')},1000); return 'DONE';" 15 | remDr %>% executeScript(sScript, args = list()) 16 | remDr %>% getAlertText() 17 | remDr %>% dismissAlert() 18 | 19 | 20 | sScript <- 21 | "setTimeout(function(){prompt('Please enter your name', '')},1000); 22 | return 'DONE';" 23 | remDr %>% executeScript(sScript, args = list()) 24 | remDr %>% getAlertText() 25 | remDr %>% sendAlertText("Buck Rogers?") 26 | 27 | remDr %>% deleteSession() 28 | -------------------------------------------------------------------------------- /inst/examples/docs/commandContexts.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | remDr <- remoteDr() 3 | remDr %>% getWindowHandle() # The current window handle 4 | remDr %>% getWindowHandles() # All windows in the session 5 | 6 | # Get the window position 7 | remDr %>% getWindowPosition 8 | 9 | # Some browsers are still using the old JSON wire end points 10 | remDr %>% getWindowPositionOld 11 | 12 | # Get the size of the window 13 | remDr %>% getWindowSize 14 | 15 | # Some browsers are still using the old JSON wire end points 16 | # remDr %>% getWindowSizeOld 17 | 18 | # Set the window size 19 | remDr %>% setWindowSize(500, 500) 20 | 21 | # Some browsers are still using the old JSON wire end points 22 | remDr %>% setWindowSizeOld(500, 500) 23 | 24 | # Set the position of the window 25 | remDr %>% setWindowPositionOld(400, 100) 26 | 27 | # Some browsers are still using the old JSON wire end points 28 | # remDr %>% setWindowPositionOld(400, 100) 29 | 30 | # Maximise the window 31 | remDr %>% maximizeWindow 32 | # Some browsers are still using the old JSON wire end points 33 | # remDr %>% maximizeWindowold() 34 | 35 | remDr %>% go("http://www.google.com/ncr") 36 | # search for the "R project" 37 | 38 | remDr %>% findElement("name", "q") %>% 39 | elementSendKeys("R project", key = "enter") 40 | 41 | webElem <- remDr %>% findElement("css", "h3.r a") 42 | 43 | remDr %>% deleteSession 44 | } 45 | -------------------------------------------------------------------------------- /inst/examples/docs/cookies.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | # assume a server is running at default location 3 | remDr <- remoteDr() 4 | remDr %>% go("https://www.google.com/ncr") %>% 5 | getTitle() 6 | # get the cookies 7 | remDr %>% getCookie() 8 | # get a named cookie 9 | remDr %>% getCookie("NID") 10 | # add our own cookie 11 | remDr %>% addCookie(name = "myCookie", value = "12") 12 | # check its value 13 | remDr %>% getCookie("myCookie") 14 | # delete our cookie 15 | remDr %>% deleteCookie("myCookie") 16 | # check its deleted 17 | remDr %>% getCookie("myCookie") 18 | 19 | # delete all cookies 20 | remDr %>% getCookie() 21 | remDr %>% deleteAllCookies() %>% 22 | getCookie() 23 | 24 | remDr %>% deleteSession() 25 | } 26 | -------------------------------------------------------------------------------- /inst/examples/docs/documentHandling.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | remDr <- remoteDr() 3 | # Get the page source 4 | remDr %>% go("https://www.google.com/ncr") %>% 5 | getPageSource 6 | 7 | remDr %>% getTitle() 8 | webElem <- remDr %>% findElement("css", "img#hplogo") 9 | # check if the logo is hidden 10 | remDr %>% executeScript("return document.getElementById('hplogo').hidden;", 11 | args = list()) 12 | # [1] FALSE 13 | # hide the logo 14 | remDr %>% executeScript("document.getElementById('hplogo').hidden = true;", 15 | args = list()) 16 | # Make the logo visible this time passing a web Element as an argument 17 | remDr %>% executeScript(script = "return arguments[0].hidden = false;", 18 | args = list(webElem)) 19 | 20 | # Pass arguments 21 | remDr %>% executeScript(script = "return argument[1] + argument[2];" 22 | , args = list(1, 2)) 23 | 24 | # Return a web Element 25 | remDr %>% executeScript( 26 | script = "return document.getElementById('hplogo');", 27 | args = list()) 28 | # ElementId: 0 29 | # Remote Driver: 30 | # Remote Ip Address: http://localhost:4444/wd/hub 31 | # Remote sessionId: 9a83672a-d72b-4873-aa7d-96f7f1f80fa0 32 | 33 | # Return a web Element in a more complex object 34 | script <- 35 | "var test ={num:1, str:'a', el:document.getElementById('hplogo')}; 36 | return test;" 37 | remDr %>% executeScript(script = script 38 | , args = list()) 39 | # $str 40 | # [1] "a" 41 | # 42 | # $num 43 | # [1] 1 44 | # 45 | # $el 46 | # ElementId: 0 47 | # Remote Driver: 48 | # Remote Ip Address: http://localhost:4444/wd/hub 49 | # Remote sessionId: 9a83672a-d72b-4873-aa7d-96f7f1f80fa0 50 | 51 | # Run with replace = FALSE 52 | remDr %>% executeScript(script = script 53 | , args = list(), replace = FALSE) 54 | # $str 55 | # [1] "a" 56 | # 57 | # $num 58 | # [1] 1 59 | # 60 | # $el 61 | # $el$ELEMENT 62 | # [1] "0" 63 | 64 | remDr %>% setTimeout("script") 65 | 66 | asScript <- "cb = arguments[0];setTimeout(function(){cb('DONE');},5000); " 67 | system.time(test1 <- remDr %>% executeAsyncScript(asScript, args = list())) 68 | sScript <- "setTimeout(function(){},5000); return 'DONE';" 69 | system.time(test2 <- remDr %>% executeScript(sScript, args = list())) 70 | 71 | 72 | remDr %>% deleteSession() 73 | 74 | } 75 | -------------------------------------------------------------------------------- /inst/examples/docs/elementInteraction.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | # start a brower 3 | remDr <- remoteDr() 4 | remDr %>% go("http://www.google.com/ncr") 5 | 6 | queryBox <- remDr %>% findElement("name", "q") 7 | 8 | # send text to the query box 9 | queryBox %>% elementSendKeys("Some ", "text") 10 | 11 | # clear the query box 12 | queryBox %>% elementClear 13 | 14 | # get the search button 15 | searchBtn <- remDr %>% findElement("name", "btnG") 16 | # send text to query box 17 | queryBox %>% elementSendKeys("R project") 18 | 19 | # click the search button 20 | searchBtn %>% elementClick 21 | 22 | # close browser 23 | remDr %>% deleteSession 24 | } 25 | -------------------------------------------------------------------------------- /inst/examples/docs/elementRetrieval.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | remDr <- remoteDr() 3 | remDr %>% go("http://www.google.com/ncr") 4 | 5 | # find the search form query box and search for "R project" 6 | webElem <- remDr %>% findElement("name", "q") %>% 7 | elementSendKeys("R project", key = "enter") 8 | # click the first link hopefully should be www.r-project.org 9 | remDr %>% findElement("css", "h3.r a") %>% elementClick 10 | 11 | # get the navigation div 12 | navElem <- remDr %>% findElement("css", "div[role='navigation']") 13 | 14 | # find all the links in this div 15 | navLinks <- navElem %>% findElementsFromElement("css", "a") 16 | 17 | # check the links 18 | nLinks <- sapply(navLinks, function(x) x %>% getElementText) 19 | 20 | # compare with all links 21 | allLinks <- remDr %>% findElements("css", "a") 22 | aLinks <- sapply(allLinks, function(x) x %>% getElementText) 23 | 24 | # show the effect of searching for elements from element 25 | aLinks %in% nLinks 26 | 27 | remDr %>% deleteSession 28 | } 29 | 30 | -------------------------------------------------------------------------------- /inst/examples/docs/elementState.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | remDr <- remoteDr() 3 | remDr %>% go("http://www.google.com/ncr") 4 | 5 | # select the search box 6 | searchElem <- remDr %>% findElement("name", "q") 7 | 8 | # get the name of our element 9 | searchElem %>% getElementAttribute("name") 10 | 11 | # get the css background-color 12 | searchElem %>% getElementCssValue("background-color") 13 | blueScript <- "arguments[0].style.backgroundColor = 'blue';" 14 | remDr %>% executeScript(blueScript, list(searchElem)) 15 | searchElem %>% getElementCssValue("background-color") 16 | 17 | # get the javascript property 18 | # searchElem %>% getElementProperty("backgroundColor") 19 | 20 | # get dimensions 21 | searchElem %>% getElementRect 22 | 23 | searchElem %>% getElementTagName 24 | 25 | # get some text and return it 26 | remDr %>% go("http://r-project.org") 27 | remDr %>% findElement("css", "h1") %>% getElementText 28 | 29 | # close browser 30 | remDr %>% deleteSession 31 | } 32 | 33 | -------------------------------------------------------------------------------- /inst/examples/docs/interactions.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | # functions not currently implemented 3 | } 4 | 5 | -------------------------------------------------------------------------------- /inst/examples/docs/navigation.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | remDr <- remoteDr() 3 | remDr %>% go("http://www.google.com/ncr") 4 | 5 | # get the title 6 | remDr %>% getTitle 7 | 8 | # get the current page url 9 | remDr %>% getCurrentUrl 10 | 11 | # navigate 12 | remDr %>% go("http://www.bbc.co.uk") 13 | 14 | # go back 15 | remDr %>% (seleniumPipes::back) 16 | 17 | # go forward 18 | remDr %>% forward 19 | 20 | # refresh page 21 | remDr %>% refresh 22 | 23 | # close browser 24 | remDr %>% deleteSession 25 | } 26 | 27 | -------------------------------------------------------------------------------- /inst/examples/docs/oldMethods.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | # functions in this group are using the old JSONwireprotocol end points 3 | } 4 | 5 | -------------------------------------------------------------------------------- /inst/examples/docs/screenCapture.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | remDr <- remoteDr() 3 | remDr %>% go("http://www.google.com/ncr") 4 | remDr %>% takeScreenshot 5 | 6 | # select the search box 7 | searchElem <- remDr %>% findElement("name", "q") 8 | #searchElem %>% takeElementScreenshot() 9 | } 10 | 11 | -------------------------------------------------------------------------------- /inst/examples/docs/sessions.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | # start a driver without opening a browser 3 | remDr <- remoteDr(newSession = FALSE) 4 | 5 | # open a broswer 6 | remDr %>% newSession 7 | 8 | # set timeout on waiting for elements 9 | remDr %>% setTimeout(type = "implicit", 5000) 10 | 11 | # close Session 12 | remDr %>% deleteSession 13 | 14 | } 15 | 16 | -------------------------------------------------------------------------------- /inst/examples/docs/userPrompts.R: -------------------------------------------------------------------------------- 1 | \dontrun{ 2 | remDr <- remoteDr() 3 | remDr %>% go("https://www.google.com/ncr") %>% 4 | getTitle() 5 | sScript <- "setTimeout(function(){alert('HELLO')},1000); return 'DONE';" 6 | remDr %>% executeScript(sScript, args = list()) 7 | remDr %>% dismissAlert() 8 | 9 | sScript <- "setTimeout(function(){confirm('Press a button')},1000); 10 | return 'DONE';" 11 | remDr %>% executeScript(sScript, args = list()) 12 | remDr %>% acceptAlert() 13 | 14 | sScript <- "setTimeout(function(){confirm('Press a button')},1000); 15 | return 'DONE';" 16 | remDr %>% executeScript(sScript, args = list()) 17 | remDr %>% getAlertText() 18 | remDr %>% dismissAlert() 19 | 20 | 21 | sScript <- 22 | "setTimeout(function(){prompt('Please enter your name', '')},1000); 23 | return 'DONE';" 24 | remDr %>% executeScript(sScript, args = list()) 25 | remDr %>% getAlertText() 26 | remDr %>% sendAlertText("Buck Rogers?") 27 | 28 | remDr %>% deleteSession() 29 | 30 | } 31 | -------------------------------------------------------------------------------- /inst/examples/elementSendKeys.R: -------------------------------------------------------------------------------- 1 | # example for elementSendkeys and elementClear and elementClick 2 | remDr <- remoteDr() 3 | remDr %>% go("https://www.google.com/ncr") 4 | remDr %>% getTitle() 5 | # usually google names its search box name="q" 6 | webElem <- remDr %>% findElement("name", "q") 7 | webElem %>% elementSendKeys("Q project") 8 | webElem %>% elementClear() 9 | webElem %>% elementSendKeys("R project", key = "enter") 10 | webElem %>% elementClear() 11 | # this time click the search button 12 | webElem %>% elementSendKeys("R project") 13 | searchButton <- remDr %>% findElement("xpath", 14 | "//button[@value='Search']") 15 | searchButton %>% elementClick 16 | 17 | # for now google urls search returns are designated h3[@class = 'r'] 18 | 19 | firstResult <- remDr %>% findElement("xpath", "//h3[@class = 'r']") 20 | firstResult %>% elementClick 21 | 22 | remDr %>% deleteSession() 23 | -------------------------------------------------------------------------------- /inst/examples/executeAsyncScript.R: -------------------------------------------------------------------------------- 1 | remDr <- remoteDr() 2 | remDr %>% setTimeout("script") 3 | remDr %>% go("https://www.google.com/ncr") 4 | remDr %>% getTitle() 5 | asScript <- 6 | "setTimeout(function(){arguments[arguments.length -1]('DONE');},5000); " 7 | system.time(test1 <- remDr %>% executeAsyncScript(asScript, args = list())) 8 | sScript <- "setTimeout(function(){},5000); return 'DONE';" 9 | system.time(test2 <- remDr %>% executeScript(sScript, args = list())) 10 | 11 | remDr %>% deleteSession() 12 | -------------------------------------------------------------------------------- /inst/examples/executeScript.R: -------------------------------------------------------------------------------- 1 | remDr <- remoteDr() 2 | remDr %>% go("https://www.google.com/ncr") 3 | remDr %>% getTitle() 4 | webElem <- remDr %>% findElement("css", "img#hplogo") 5 | # check if the logo is hidden 6 | remDr %>% executeScript("return document.getElementById('hplogo').hidden;", 7 | args = list()) 8 | # [1] FALSE 9 | # hide the logo 10 | remDr %>% executeScript("document.getElementById('hplogo').hidden = true;", 11 | args = list()) 12 | # Make the logo visible this time passing a web Element as an argument 13 | remDr %>% executeScript(script = "return arguments[0].hidden = false;", 14 | args = list(webElem)) 15 | 16 | # Return a web Element 17 | remDr %>% 18 | executeScript(script = "return document.getElementById('hplogo');", 19 | args = list()) 20 | # ElementId: 0 21 | # Remote Driver: 22 | # Remote Ip Address: http://localhost:4444/wd/hub 23 | # Remote sessionId: 9a83672a-d72b-4873-aa7d-96f7f1f80fa0 24 | 25 | # Return a web Element in a more complex object 26 | myS <- "var test ={num:1, str:'a', el:document.getElementById('hplogo')}; 27 | return test;" 28 | remDr %>% executeScript(script = myS , args = list()) 29 | # $str 30 | # [1] "a" 31 | # 32 | # $num 33 | # [1] 1 34 | # 35 | # $el 36 | # ElementId: 0 37 | # Remote Driver: 38 | # Remote Ip Address: http://localhost:4444/wd/hub 39 | # Remote sessionId: 9a83672a-d72b-4873-aa7d-96f7f1f80fa0 40 | 41 | # Run with replace = FALSE 42 | myS <- "var test ={num:1, str:'a', el:document.getElementById('hplogo')}; 43 | return test;" 44 | remDr %>% executeScript(script = myS, args = list(), replace = FALSE) 45 | # $str 46 | # [1] "a" 47 | # 48 | # $num 49 | # [1] 1 50 | # 51 | # $el 52 | # $el$ELEMENT 53 | # [1] "0" 54 | 55 | remDr %>% deleteSession() 56 | 57 | -------------------------------------------------------------------------------- /inst/examples/findElement.R: -------------------------------------------------------------------------------- 1 | remDr <- remoteDr() 2 | remDr %>% go("https://cran.r-project.org/") 3 | remDr %>% getTitle() 4 | frames <- remDr %>% getPageSource() %>% 5 | xml_find_all("//frame") %>% 6 | xml_attr("name") 7 | 8 | webElem <- remDr %>% findElement("css", "frame") 9 | 10 | remDr %>% deleteSession() 11 | -------------------------------------------------------------------------------- /inst/examples/findElementFromElement.R: -------------------------------------------------------------------------------- 1 | remDr <- remoteDr() 2 | remDr %>% go("https://cran.r-project.org/") 3 | remDr %>% getTitle() 4 | frames <- remDr %>% getPageSource() %>% 5 | xml_find_all("//frame") %>% 6 | xml_attr("name") 7 | 8 | # Switch to the main body 9 | webElem <- remDr %>% findElements("css", "frame") 10 | remDr %>% switchToFrame(webElem[[3]]) 11 | 12 | # find the table 13 | webElem <- remDr %>% findElement("css", "table") 14 | # within the first row of the table get the 2nd link 15 | link2 <- webElem %>% findElementFromElement("css", "li:nth-child(2) a") 16 | 17 | remDr %>% deleteSession() 18 | -------------------------------------------------------------------------------- /inst/examples/findElements.R: -------------------------------------------------------------------------------- 1 | remDr <- remoteDr() 2 | remDr %>% go("https://cran.r-project.org/") 3 | remDr %>% getTitle() 4 | frames <- remDr %>% getPageSource() %>% 5 | xml_find_all("//frame") %>% 6 | xml_attr("name") 7 | 8 | webElem <- remDr %>% findElements("css", "frame") 9 | 10 | remDr %>% deleteSession() 11 | -------------------------------------------------------------------------------- /inst/examples/findElementsFromElement.R: -------------------------------------------------------------------------------- 1 | remDr <- remoteDr() 2 | remDr %>% go("https://cran.r-project.org/") 3 | remDr %>% getTitle() 4 | frames <- remDr %>% getPageSource() %>% 5 | xml_find_all("//frame") %>% 6 | xml_attr("name") 7 | 8 | # Switch to the main body 9 | webElem <- remDr %>% findElements("css", "frame") 10 | remDr %>% switchToFrame(webElem[[3]]) 11 | 12 | # find the table 2nd row 13 | webElem <- remDr %>% findElement("css", "table tr:nth-child(2)") 14 | # from the 2nd row of the table get the links 15 | links <- webElem %>% findElementsFromElement("css", "a") 16 | 17 | remDr %>% deleteSession() 18 | -------------------------------------------------------------------------------- /inst/examples/getCookie.R: -------------------------------------------------------------------------------- 1 | # Examples for xxxCookie 2 | remDr <- remoteDr() 3 | remDr %>% go("https://www.google.com/ncr") 4 | remDr %>% getTitle() 5 | remDr %>% getCookie() 6 | remDr %>% getCookie("NID") 7 | remDr %>% addCookie(name = "myCookie", value = "12") 8 | remDr %>% getCookie("myCookie") 9 | remDr %>% deleteCookie("myCookie") 10 | remDr %>% getCookie("myCookie") 11 | remDr %>% getCookie() 12 | remDr %>% deleteAllCookies() 13 | remDr %>% getCookie() 14 | 15 | remDr %>% deleteSession() 16 | -------------------------------------------------------------------------------- /inst/examples/getElementxxx.R: -------------------------------------------------------------------------------- 1 | # examples for getElementxxx type functions 2 | 3 | remDr <- remoteDr() 4 | remDr %>% go("https://www.google.com/ncr") 5 | remDr %>% getTitle() 6 | # usually google names its search box name="q" 7 | webElem <- remDr %>% findElement("name", "q") 8 | # observe the structure 9 | webElem %>% getElementAttribute("outerHTML") %>% 10 | read_html %>% 11 | html_structure 12 | # 13 | # 14 | # 16 | 17 | webElem %>% getElementAttribute("id") 18 | # [1] "lst-ib" 19 | webElem %>% getElementCssValue("color") 20 | # [1] "rgba(0, 0, 0, 1)" 21 | webElem %>% getElementCssValue("font-family") 22 | # [1] "arial,sans-serif" 23 | 24 | # search for google search button (Usually has text = Google Search) 25 | webElem <- remDr %>% findElement("xpath", 26 | "//input[@value='Google Search']") 27 | webElem %>% getElementTagName() 28 | # [1] "input" 29 | 30 | webElem %>% getElementRect() %>% str 31 | # List of 8 32 | # $ x : int 463 33 | # $ width : int 132 34 | # $ y : int 392 35 | # $ hCode : int -2121007104 36 | # $ dimension: NULL 37 | # $ class : chr "org.openqa.selenium.Rectangle" 38 | # $ point : NULL 39 | # $ height : int 36 40 | 41 | remDr %>% deleteSession() 42 | -------------------------------------------------------------------------------- /inst/examples/switchToFrame.R: -------------------------------------------------------------------------------- 1 | remDr <- remoteDr() 2 | remDr %>% go("https://cran.r-project.org/") 3 | remDr %>% getTitle() 4 | frames <- remDr %>% getPageSource() %>% 5 | xml_find_all("//frame") %>% 6 | xml_attr("name") 7 | 8 | # switch to main body 9 | remDr %>% switchToFrame(frames[3]) 10 | remDr %>% getPageSource() %>% xml_find_all("//a") 11 | remDr %>% getPageSource() %>% xml_find_all("//a") %>% length 12 | #[1] 17 13 | 14 | # switch back to main frame 15 | 16 | remDr %>% switchToFrame() 17 | remDr %>% getPageSource() %>% html_structure() 18 | 19 | # switch to side bar 20 | remDr %>% switchToFrame(frames[2]) 21 | remDr %>% getPageSource() %>% xml_find_all("//a") 22 | remDr %>% getPageSource() %>% xml_find_all("//a") %>% length 23 | # [1] 13 24 | 25 | remDr %>% deleteSession() 26 | -------------------------------------------------------------------------------- /man-roxygen/ellipsis.R: -------------------------------------------------------------------------------- 1 | #' @param ... Additonal function arguments - Currently passes the 2 | #' \code{\link{retry}} argument. 3 | -------------------------------------------------------------------------------- /man-roxygen/locator.R: -------------------------------------------------------------------------------- 1 | #' @details 2 | #' Details of possible locator schemes 3 | #' \describe{ 4 | #' \item{"class name" :}{Returns an element whose class name contains 5 | #' the search value; compound class names are not permitted.} 6 | #' \item{"css selector" :}{Returns an element matching a CSS selector.} 7 | #' \item{"id" :}{Returns an element whose ID attribute matches the 8 | #' search value.} 9 | #' \item{"name" :}{Returns an element whose NAME attribute matches 10 | #' the search value.} 11 | #' \item{"link text" :}{Returns an anchor element whose visible text 12 | #' matches the search value.} 13 | #' \item{"partial link text" :}{Returns an anchor element whose 14 | #' visible text partially matches the search value.} 15 | #' \item{"tag name" :}{Returns an element whose tag name matches the 16 | #' search value.} 17 | #' \item{"xpath" :}{Returns an element matching an XPath expression.} 18 | #' } 19 | #' 20 | -------------------------------------------------------------------------------- /man-roxygen/remDr.R: -------------------------------------------------------------------------------- 1 | #' @param remDr An object of class "rDriver". A remote driver object see 2 | #' \code{\link{remoteDr}}. 3 | -------------------------------------------------------------------------------- /man-roxygen/ret1.R: -------------------------------------------------------------------------------- 1 | #' @return invisible(remDr): An object of class "rDriver" is invisibly 2 | #' returned. A remote driver object see \code{\link{remoteDr}}. This 3 | #' allows for chaining from this function to other functions that take 4 | #' such an object as an argument. See examples for further details. 5 | -------------------------------------------------------------------------------- /man-roxygen/ret10.R: -------------------------------------------------------------------------------- 1 | #' @return invisible(wbElement(res$value, webElem$remDr)): An object of 2 | #' class "wElement" is invisibly returned. A webElement object see 3 | #' \code{\link{wbElement}}. This allows for chaining from this function 4 | #' to other functions that take such an object as an argument. See 5 | #' examples for further details. 6 | -------------------------------------------------------------------------------- /man-roxygen/ret11.R: -------------------------------------------------------------------------------- 1 | #' @return invisible(lapply(res$value, wbElement, remDr = webElem$remDr)): 2 | #' A list of objects of class "wElement" is invisibly returned. A 3 | #' webElement object see \code{\link{wbElement}}. This allows for 4 | #' chaining from this function to other functions that take such an 5 | #' object as an argument. See examples for further details. 6 | -------------------------------------------------------------------------------- /man-roxygen/ret12.R: -------------------------------------------------------------------------------- 1 | #' @return If \code{returnPNG} is FALSE the remote Driver object is 2 | #' returned and additonal chaining is possible. If TRUE then the 3 | #' decoded base64 image is returned see \code{\link{base64_dec}} 4 | -------------------------------------------------------------------------------- /man-roxygen/ret13.R: -------------------------------------------------------------------------------- 1 | #' @return If \code{returnPNG} is FALSE the web Element object is returned 2 | #' and additonal chaining is possible. If TRUE then the decoded base64 3 | #' image is returned see \code{\link{base64_dec}} 4 | -------------------------------------------------------------------------------- /man-roxygen/ret2.R: -------------------------------------------------------------------------------- 1 | #' @return ret2 : res$value NEED TO FILL IN specifics for each function 2 | -------------------------------------------------------------------------------- /man-roxygen/ret3.R: -------------------------------------------------------------------------------- 1 | #' @return read_html(res$value): An xml document is returned. 2 | #' The content from the remote webdriver is parsed (see 3 | #' \code{\link{read_html}}) and returned as xml. 4 | -------------------------------------------------------------------------------- /man-roxygen/ret4.R: -------------------------------------------------------------------------------- 1 | #' @return invisible(wbElement(res$value, remDr)): An object of class 2 | #' "wElement" is invisibly returned. A webElement object see 3 | #' \code{\link{wbElement}}. This allows for chaining from this function 4 | #' to other functions that take such an object as an argument. See 5 | #' examples for further details. 6 | -------------------------------------------------------------------------------- /man-roxygen/ret5.R: -------------------------------------------------------------------------------- 1 | #' @return invisible(lapply(res$value, wbElement, remDr = remDr)): A list 2 | #' of objects of class "wElement" is invisibly returned. A webElement 3 | #' object see \code{\link{wbElement}}. This allows for chaining from 4 | #' this function to other functions that take such an object as an 5 | #' argument. See examples for further details. 6 | -------------------------------------------------------------------------------- /man-roxygen/ret6.R: -------------------------------------------------------------------------------- 1 | #' @return If replace is TRUE parses the response from the server for web 2 | #' Elements and converts as such. Otherwise the content returned is 3 | #' assummed to be a simple list. 4 | #' 5 | -------------------------------------------------------------------------------- /man-roxygen/ret7.R: -------------------------------------------------------------------------------- 1 | #' @return invisible(webElem): An object of class "wElement" is invisibly 2 | #' returned. A webElement object see \code{\link{wbElement}}. This 3 | #' allows for chaining from this function to other functions that take 4 | #' such an object as an argument. See examples for further details. 5 | -------------------------------------------------------------------------------- /man-roxygen/ret8.R: -------------------------------------------------------------------------------- 1 | #' @return invisible(remDr): An object of class "rDriver" is invisibly 2 | #' returned. A remote driver object see \code{\link{remoteDr}}. This 3 | #' allows for chaining from this function to other functions that take 4 | #' such an object as an argument. See examples for further details. 5 | -------------------------------------------------------------------------------- /man-roxygen/ret9.R: -------------------------------------------------------------------------------- 1 | #' @return Returns an object of class "rDriver". The sessionId associated 2 | #' with this driver has been removed however and the associated browser 3 | #' should be closed by the server. 4 | -------------------------------------------------------------------------------- /man-roxygen/webElem.R: -------------------------------------------------------------------------------- 1 | #' @param webElem An object of class "wElement". A web Element object see 2 | #' \code{\link{wbElement}}. 3 | -------------------------------------------------------------------------------- /man/acceptAlert.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/userPrompts.R, R/userPromptsDoc.R 3 | \name{acceptAlert} 4 | \alias{acceptAlert} 5 | \title{Accept alert} 6 | \usage{ 7 | acceptAlert(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{acceptAlert} accept a JavaScript alert 24 | } 25 | \examples{ 26 | \dontrun{ 27 | remDr <- remoteDr() 28 | remDr \%>\% go("https://www.google.com/ncr") \%>\% 29 | getTitle() 30 | sScript <- "setTimeout(function(){alert('HELLO')},1000); return 'DONE';" 31 | remDr \%>\% executeScript(sScript, args = list()) 32 | remDr \%>\% dismissAlert() 33 | 34 | sScript <- "setTimeout(function(){confirm('Press a button')},1000); 35 | return 'DONE';" 36 | remDr \%>\% executeScript(sScript, args = list()) 37 | remDr \%>\% acceptAlert() 38 | 39 | sScript <- "setTimeout(function(){confirm('Press a button')},1000); 40 | return 'DONE';" 41 | remDr \%>\% executeScript(sScript, args = list()) 42 | remDr \%>\% getAlertText() 43 | remDr \%>\% dismissAlert() 44 | 45 | 46 | sScript <- 47 | "setTimeout(function(){prompt('Please enter your name', '')},1000); 48 | return 'DONE';" 49 | remDr \%>\% executeScript(sScript, args = list()) 50 | remDr \%>\% getAlertText() 51 | remDr \%>\% sendAlertText("Buck Rogers?") 52 | 53 | remDr \%>\% deleteSession() 54 | 55 | } 56 | } 57 | \seealso{ 58 | Other userPrompts functions: \code{\link{dismissAlert}}, 59 | \code{\link{getAlertText}}, \code{\link{sendAlertText}} 60 | } 61 | 62 | -------------------------------------------------------------------------------- /man/acceptAlertOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{acceptAlertOld} 4 | \alias{acceptAlertOld} 5 | \title{Accept alert} 6 | \usage{ 7 | acceptAlertOld(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{acceptAlertOld} accept a JavaScript alert This uses the old 24 | JSONwireprotocol endpoints. 25 | } 26 | \examples{ 27 | \dontrun{ 28 | # functions in this group are using the old JSONwireprotocol end points 29 | } 30 | 31 | } 32 | \seealso{ 33 | Other oldMethods functions: \code{\link{dismissAlertOld}}, 34 | \code{\link{executeAsyncScriptOld}}, 35 | \code{\link{executeScriptOld}}, 36 | \code{\link{getAlertTextOld}}, 37 | \code{\link{getWindowHandleOld}}, 38 | \code{\link{getWindowHandlesOld}}, 39 | \code{\link{getWindowPositionOld}}, 40 | \code{\link{getWindowSizeOld}}, 41 | \code{\link{maximizeWindowOld}}, 42 | \code{\link{sendAlertTextOld}}, 43 | \code{\link{setWindowPositionOld}}, 44 | \code{\link{setWindowSizeOld}} 45 | } 46 | 47 | -------------------------------------------------------------------------------- /man/addCookie.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cookies.R, R/cookiesDoc.R 3 | \name{addCookie} 4 | \alias{addCookie} 5 | \title{Add a specific cookie.} 6 | \usage{ 7 | addCookie(remDr, name, value, path = NULL, domain = NULL, secure = FALSE, 8 | httpOnly = NULL, expiry = NULL, ...) 9 | } 10 | \arguments{ 11 | \item{remDr}{An object of class "rDriver". A remote driver object see 12 | \code{\link{remoteDr}}.} 13 | 14 | \item{name}{character: The name of the cookie; may not be null or an 15 | empty string} 16 | 17 | \item{value}{character: The cookie value; may not be null.} 18 | 19 | \item{path}{character: The path the cookie is visible to. If left blank 20 | or set to null, will be set to "/".} 21 | 22 | \item{domain}{character: The domain the cookie is visible to. It should 23 | be null or the same as the domain of the current URL.} 24 | 25 | \item{secure}{logical: Whether this cookie requires a secure 26 | connection(https?). It should be null or equal to the security of 27 | the current URL.} 28 | 29 | \item{httpOnly}{logical: Whether the cookie is an httpOnly cookie.} 30 | 31 | \item{expiry}{The cookie's expiration date; may be null.} 32 | 33 | \item{...}{Additonal function arguments - Currently passes the 34 | \code{\link{retry}} argument.} 35 | } 36 | \value{ 37 | invisible(remDr): An object of class "rDriver" is invisibly 38 | returned. A remote driver object see \code{\link{remoteDr}}. This 39 | allows for chaining from this function to other functions that take 40 | such an object as an argument. See examples for further details. 41 | } 42 | \description{ 43 | \code{addCookie} Add a specific cookie. 44 | } 45 | \examples{ 46 | \dontrun{ 47 | # assume a server is running at default location 48 | remDr <- remoteDr() 49 | remDr \%>\% go("https://www.google.com/ncr") \%>\% 50 | getTitle() 51 | # get the cookies 52 | remDr \%>\% getCookie() 53 | # get a named cookie 54 | remDr \%>\% getCookie("NID") 55 | # add our own cookie 56 | remDr \%>\% addCookie(name = "myCookie", value = "12") 57 | # check its value 58 | remDr \%>\% getCookie("myCookie") 59 | # delete our cookie 60 | remDr \%>\% deleteCookie("myCookie") 61 | # check its deleted 62 | remDr \%>\% getCookie("myCookie") 63 | 64 | # delete all cookies 65 | remDr \%>\% getCookie() 66 | remDr \%>\% deleteAllCookies() \%>\% 67 | getCookie() 68 | 69 | remDr \%>\% deleteSession() 70 | } 71 | } 72 | \seealso{ 73 | Other cookies functions: \code{\link{deleteAllCookies}}, 74 | \code{\link{deleteCookie}}, \code{\link{getAllCookies}}, 75 | \code{\link{getNamedCookie}} 76 | } 77 | 78 | -------------------------------------------------------------------------------- /man/back.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/navigation.R, R/navigationDoc.R 3 | \name{back} 4 | \alias{back} 5 | \title{Navigate backwards} 6 | \usage{ 7 | back(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{back} Navigate backwards in the browser history, if possible. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | remDr <- remoteDr() 28 | remDr \%>\% go("http://www.google.com/ncr") 29 | 30 | # get the title 31 | remDr \%>\% getTitle 32 | 33 | # get the current page url 34 | remDr \%>\% getCurrentUrl 35 | 36 | # navigate 37 | remDr \%>\% go("http://www.bbc.co.uk") 38 | 39 | # go back 40 | remDr \%>\% (seleniumPipes::back) 41 | 42 | # go forward 43 | remDr \%>\% forward 44 | 45 | # refresh page 46 | remDr \%>\% refresh 47 | 48 | # close browser 49 | remDr \%>\% deleteSession 50 | } 51 | 52 | } 53 | \seealso{ 54 | Other navigation functions: \code{\link{forward}}, 55 | \code{\link{getCurrentUrl}}, \code{\link{getTitle}}, 56 | \code{\link{go}}, \code{\link{refresh}} 57 | } 58 | 59 | -------------------------------------------------------------------------------- /man/checkResponse.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/init.R 3 | \name{checkResponse} 4 | \alias{checkResponse} 5 | \title{Check the response from remote server} 6 | \usage{ 7 | checkResponse(response) 8 | } 9 | \arguments{ 10 | \item{response}{The value returned by a http method from httr see 11 | \code{\link{VERB}}} 12 | } 13 | \value{ 14 | Stops with appropriate error if any found. On error 15 | \code{\link{errorResponse}} and \code{\link{errorContent}} may 16 | provide additional detail. 17 | } 18 | \description{ 19 | \code{checkResponse} checks the response from a remote web driver and 20 | checks against known errors. uses statusCodes in sysdata.rda see 21 | seleniumPipes:::statusCodes 22 | } 23 | \examples{ 24 | \dontrun{ 25 | # internal method 26 | } 27 | 28 | } 29 | 30 | -------------------------------------------------------------------------------- /man/closeWindow.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{closeWindow} 4 | \alias{closeWindow} 5 | \title{Close the current window.} 6 | \usage{ 7 | closeWindow(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{closeWindow} Close the current window. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | remDr <- remoteDr() 28 | remDr \%>\% getWindowHandle() # The current window handle 29 | remDr \%>\% getWindowHandles() # All windows in the session 30 | 31 | # Get the window position 32 | remDr \%>\% getWindowPosition 33 | 34 | # Some browsers are still using the old JSON wire end points 35 | remDr \%>\% getWindowPositionOld 36 | 37 | # Get the size of the window 38 | remDr \%>\% getWindowSize 39 | 40 | # Some browsers are still using the old JSON wire end points 41 | # remDr \%>\% getWindowSizeOld 42 | 43 | # Set the window size 44 | remDr \%>\% setWindowSize(500, 500) 45 | 46 | # Some browsers are still using the old JSON wire end points 47 | remDr \%>\% setWindowSizeOld(500, 500) 48 | 49 | # Set the position of the window 50 | remDr \%>\% setWindowPositionOld(400, 100) 51 | 52 | # Some browsers are still using the old JSON wire end points 53 | # remDr \%>\% setWindowPositionOld(400, 100) 54 | 55 | # Maximise the window 56 | remDr \%>\% maximizeWindow 57 | # Some browsers are still using the old JSON wire end points 58 | # remDr \%>\% maximizeWindowold() 59 | 60 | remDr \%>\% go("http://www.google.com/ncr") 61 | # search for the "R project" 62 | 63 | remDr \%>\% findElement("name", "q") \%>\% 64 | elementSendKeys("R project", key = "enter") 65 | 66 | webElem <- remDr \%>\% findElement("css", "h3.r a") 67 | 68 | remDr \%>\% deleteSession 69 | } 70 | } 71 | \seealso{ 72 | Other commandContexts functions: \code{\link{fullscreenWindow}}, 73 | \code{\link{getWindowHandles}}, 74 | \code{\link{getWindowHandle}}, 75 | \code{\link{getWindowPosition}}, 76 | \code{\link{getWindowSize}}, 77 | \code{\link{maximizeWindow}}, 78 | \code{\link{setWindowPosition}}, 79 | \code{\link{setWindowSize}}, \code{\link{switchToFrame}}, 80 | \code{\link{switchToParentFrame}}, 81 | \code{\link{switchToWindow}} 82 | } 83 | 84 | -------------------------------------------------------------------------------- /man/deleteAllCookies.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cookies.R, R/cookiesDoc.R 3 | \name{deleteAllCookies} 4 | \alias{deleteAllCookies} 5 | \title{Delete all the cookies.} 6 | \usage{ 7 | deleteAllCookies(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{deleteAllCookies} Delete all the cookies that are currently 24 | visible. 25 | } 26 | \examples{ 27 | \dontrun{ 28 | # assume a server is running at default location 29 | remDr <- remoteDr() 30 | remDr \%>\% go("https://www.google.com/ncr") \%>\% 31 | getTitle() 32 | # get the cookies 33 | remDr \%>\% getCookie() 34 | # get a named cookie 35 | remDr \%>\% getCookie("NID") 36 | # add our own cookie 37 | remDr \%>\% addCookie(name = "myCookie", value = "12") 38 | # check its value 39 | remDr \%>\% getCookie("myCookie") 40 | # delete our cookie 41 | remDr \%>\% deleteCookie("myCookie") 42 | # check its deleted 43 | remDr \%>\% getCookie("myCookie") 44 | 45 | # delete all cookies 46 | remDr \%>\% getCookie() 47 | remDr \%>\% deleteAllCookies() \%>\% 48 | getCookie() 49 | 50 | remDr \%>\% deleteSession() 51 | } 52 | } 53 | \seealso{ 54 | Other cookies functions: \code{\link{addCookie}}, 55 | \code{\link{deleteCookie}}, \code{\link{getAllCookies}}, 56 | \code{\link{getNamedCookie}} 57 | } 58 | 59 | -------------------------------------------------------------------------------- /man/deleteCookie.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cookies.R, R/cookiesDoc.R 3 | \name{deleteCookie} 4 | \alias{deleteCookie} 5 | \title{Delete a given cookie.} 6 | \usage{ 7 | deleteCookie(remDr, name = NULL, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{name}{character: The name of the cookie; may not be null or an 14 | empty string} 15 | 16 | \item{...}{Additonal function arguments - Currently passes the 17 | \code{\link{retry}} argument.} 18 | } 19 | \value{ 20 | invisible(remDr): An object of class "rDriver" is invisibly 21 | returned. A remote driver object see \code{\link{remoteDr}}. This 22 | allows for chaining from this function to other functions that take 23 | such an object as an argument. See examples for further details. 24 | } 25 | \description{ 26 | \code{deleteCookie} Delete the cookie with the give name. 27 | } 28 | \examples{ 29 | \dontrun{ 30 | # assume a server is running at default location 31 | remDr <- remoteDr() 32 | remDr \%>\% go("https://www.google.com/ncr") \%>\% 33 | getTitle() 34 | # get the cookies 35 | remDr \%>\% getCookie() 36 | # get a named cookie 37 | remDr \%>\% getCookie("NID") 38 | # add our own cookie 39 | remDr \%>\% addCookie(name = "myCookie", value = "12") 40 | # check its value 41 | remDr \%>\% getCookie("myCookie") 42 | # delete our cookie 43 | remDr \%>\% deleteCookie("myCookie") 44 | # check its deleted 45 | remDr \%>\% getCookie("myCookie") 46 | 47 | # delete all cookies 48 | remDr \%>\% getCookie() 49 | remDr \%>\% deleteAllCookies() \%>\% 50 | getCookie() 51 | 52 | remDr \%>\% deleteSession() 53 | } 54 | } 55 | \seealso{ 56 | Other cookies functions: \code{\link{addCookie}}, 57 | \code{\link{deleteAllCookies}}, 58 | \code{\link{getAllCookies}}, \code{\link{getNamedCookie}} 59 | } 60 | 61 | -------------------------------------------------------------------------------- /man/deleteSession.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sessions.R, R/sessionsDoc.R 3 | \name{deleteSession} 4 | \alias{deleteSession} 5 | \title{Delete the session.} 6 | \usage{ 7 | deleteSession(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | Returns an object of class "rDriver". The sessionId associated 18 | with this driver has been removed however and the associated browser 19 | should be closed by the server. 20 | } 21 | \description{ 22 | \code{deleteSession} Delete the session. 23 | } 24 | \examples{ 25 | \dontrun{ 26 | # start a driver without opening a browser 27 | remDr <- remoteDr(newSession = FALSE) 28 | 29 | # open a broswer 30 | remDr \%>\% newSession 31 | 32 | # set timeout on waiting for elements 33 | remDr \%>\% setTimeout(type = "implicit", 5000) 34 | 35 | # close Session 36 | remDr \%>\% deleteSession 37 | 38 | } 39 | 40 | } 41 | \seealso{ 42 | Other sessions functions: \code{\link{getTimeouts}}, 43 | \code{\link{newSession}}, \code{\link{setTimeouts}}, 44 | \code{\link{status}} 45 | } 46 | 47 | -------------------------------------------------------------------------------- /man/dismissAlert.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/userPrompts.R, R/userPromptsDoc.R 3 | \name{dismissAlert} 4 | \alias{dismissAlert} 5 | \title{Dismiss Alert} 6 | \usage{ 7 | dismissAlert(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{dismissAlert} dismiss a JavaScript alert 24 | } 25 | \examples{ 26 | \dontrun{ 27 | remDr <- remoteDr() 28 | remDr \%>\% go("https://www.google.com/ncr") \%>\% 29 | getTitle() 30 | sScript <- "setTimeout(function(){alert('HELLO')},1000); return 'DONE';" 31 | remDr \%>\% executeScript(sScript, args = list()) 32 | remDr \%>\% dismissAlert() 33 | 34 | sScript <- "setTimeout(function(){confirm('Press a button')},1000); 35 | return 'DONE';" 36 | remDr \%>\% executeScript(sScript, args = list()) 37 | remDr \%>\% acceptAlert() 38 | 39 | sScript <- "setTimeout(function(){confirm('Press a button')},1000); 40 | return 'DONE';" 41 | remDr \%>\% executeScript(sScript, args = list()) 42 | remDr \%>\% getAlertText() 43 | remDr \%>\% dismissAlert() 44 | 45 | 46 | sScript <- 47 | "setTimeout(function(){prompt('Please enter your name', '')},1000); 48 | return 'DONE';" 49 | remDr \%>\% executeScript(sScript, args = list()) 50 | remDr \%>\% getAlertText() 51 | remDr \%>\% sendAlertText("Buck Rogers?") 52 | 53 | remDr \%>\% deleteSession() 54 | 55 | } 56 | } 57 | \seealso{ 58 | Other userPrompts functions: \code{\link{acceptAlert}}, 59 | \code{\link{getAlertText}}, \code{\link{sendAlertText}} 60 | } 61 | 62 | -------------------------------------------------------------------------------- /man/dismissAlertOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{dismissAlertOld} 4 | \alias{dismissAlertOld} 5 | \title{Dismiss Alert} 6 | \usage{ 7 | dismissAlertOld(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{dismissAlertOld} dismiss a JavaScript alert. This uses the old 24 | JSONwireprotocol endpoints. 25 | } 26 | \examples{ 27 | \dontrun{ 28 | # functions in this group are using the old JSONwireprotocol end points 29 | } 30 | 31 | } 32 | \seealso{ 33 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 34 | \code{\link{executeAsyncScriptOld}}, 35 | \code{\link{executeScriptOld}}, 36 | \code{\link{getAlertTextOld}}, 37 | \code{\link{getWindowHandleOld}}, 38 | \code{\link{getWindowHandlesOld}}, 39 | \code{\link{getWindowPositionOld}}, 40 | \code{\link{getWindowSizeOld}}, 41 | \code{\link{maximizeWindowOld}}, 42 | \code{\link{sendAlertTextOld}}, 43 | \code{\link{setWindowPositionOld}}, 44 | \code{\link{setWindowSizeOld}} 45 | } 46 | 47 | -------------------------------------------------------------------------------- /man/elementClear.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementInteraction.R, R/elementInteractionDoc.R 3 | \name{elementClear} 4 | \alias{elementClear} 5 | \title{Clear an elements text value.} 6 | \usage{ 7 | elementClear(webElem, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(webElem): An object of class "wElement" is invisibly 18 | returned. A webElement object see \code{\link{wbElement}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{elementClear} Clear a TEXTAREA or text INPUT element's value. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | # start a brower 28 | remDr <- remoteDr() 29 | remDr \%>\% go("http://www.google.com/ncr") 30 | 31 | queryBox <- remDr \%>\% findElement("name", "q") 32 | 33 | # send text to the query box 34 | queryBox \%>\% elementSendKeys("Some ", "text") 35 | 36 | # clear the query box 37 | queryBox \%>\% elementClear 38 | 39 | # get the search button 40 | searchBtn <- remDr \%>\% findElement("name", "btnG") 41 | # send text to query box 42 | queryBox \%>\% elementSendKeys("R project") 43 | 44 | # click the search button 45 | searchBtn \%>\% elementClick 46 | 47 | # close browser 48 | remDr \%>\% deleteSession 49 | } 50 | } 51 | \seealso{ 52 | Other elementInteraction functions: \code{\link{elementClick}}, 53 | \code{\link{elementSendKeys}} 54 | } 55 | 56 | -------------------------------------------------------------------------------- /man/elementClick.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementInteraction.R, R/elementInteractionDoc.R 3 | \name{elementClick} 4 | \alias{elementClick} 5 | \title{Click on an element.} 6 | \usage{ 7 | elementClick(webElem, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(webElem): An object of class "wElement" is invisibly 18 | returned. A webElement object see \code{\link{wbElement}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{elementClick} The elementClick function scrolls into view the 24 | element and clicks the in-view centre point. If the element is not 25 | pointer-interactable, an element not interactable error is returned. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | # start a brower 30 | remDr <- remoteDr() 31 | remDr \%>\% go("http://www.google.com/ncr") 32 | 33 | queryBox <- remDr \%>\% findElement("name", "q") 34 | 35 | # send text to the query box 36 | queryBox \%>\% elementSendKeys("Some ", "text") 37 | 38 | # clear the query box 39 | queryBox \%>\% elementClear 40 | 41 | # get the search button 42 | searchBtn <- remDr \%>\% findElement("name", "btnG") 43 | # send text to query box 44 | queryBox \%>\% elementSendKeys("R project") 45 | 46 | # click the search button 47 | searchBtn \%>\% elementClick 48 | 49 | # close browser 50 | remDr \%>\% deleteSession 51 | } 52 | } 53 | \seealso{ 54 | Other elementInteraction functions: \code{\link{elementClear}}, 55 | \code{\link{elementSendKeys}} 56 | } 57 | 58 | -------------------------------------------------------------------------------- /man/elementSendKeys.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementInteraction.R, R/elementInteractionDoc.R 3 | \name{elementSendKeys} 4 | \alias{elementSendKeys} 5 | \title{Send a sequence of key strokes to an element.} 6 | \usage{ 7 | elementSendKeys(webElem, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{...}{keys to send the element. \code{seleniumPipes} includes 14 | mappings to unicode keys see \code{\link{selKeys}}. To use one of 15 | this name the string using key. See examples.} 16 | } 17 | \value{ 18 | invisible(webElem): An object of class "wElement" is invisibly 19 | returned. A webElement object see \code{\link{wbElement}}. This 20 | allows for chaining from this function to other functions that take 21 | such an object as an argument. See examples for further details. 22 | } 23 | \description{ 24 | \code{elementSendKeys} The elementSendKeys function scrolls into view 25 | the form control element and then sends the provided keys to the 26 | element. In case the element is not keyboard interactable, an 27 | element not interactable error is returned. 28 | } 29 | \examples{ 30 | \dontrun{ 31 | # start a brower 32 | remDr <- remoteDr() 33 | remDr \%>\% go("http://www.google.com/ncr") 34 | 35 | queryBox <- remDr \%>\% findElement("name", "q") 36 | 37 | # send text to the query box 38 | queryBox \%>\% elementSendKeys("Some ", "text") 39 | 40 | # clear the query box 41 | queryBox \%>\% elementClear 42 | 43 | # get the search button 44 | searchBtn <- remDr \%>\% findElement("name", "btnG") 45 | # send text to query box 46 | queryBox \%>\% elementSendKeys("R project") 47 | 48 | # click the search button 49 | searchBtn \%>\% elementClick 50 | 51 | # close browser 52 | remDr \%>\% deleteSession 53 | } 54 | } 55 | \seealso{ 56 | Other elementInteraction functions: \code{\link{elementClear}}, 57 | \code{\link{elementClick}} 58 | } 59 | 60 | -------------------------------------------------------------------------------- /man/errorContent.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/init.R 3 | \name{errorContent} 4 | \alias{errorContent} 5 | \title{Returns the content from remote webdriver} 6 | \usage{ 7 | errorContent() 8 | } 9 | \value{ 10 | returns content see \code{\link{content}} 11 | } 12 | \description{ 13 | \code{errorContent} returns the content from the remote webdriver on an 14 | error. 15 | } 16 | \examples{ 17 | \dontrun{ 18 | remDr <- remoteDr() 19 | remDr \%>\% findElement("name", "sdofnsdofk") 20 | errorContent() 21 | } 22 | } 23 | 24 | -------------------------------------------------------------------------------- /man/errorResponse.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/init.R 3 | \name{errorResponse} 4 | \alias{errorResponse} 5 | \title{Return the response from remote webdriver} 6 | \usage{ 7 | errorResponse() 8 | } 9 | \value{ 10 | returns response see \code{\link{VERB}}. Headers, request etc. 11 | can be examined from this object. 12 | } 13 | \description{ 14 | \code{errorResponse} returns the response from the remote webdriver on 15 | an error. 16 | } 17 | \examples{ 18 | \dontrun{ 19 | remDr <- remoteDr() 20 | remDr \%>\% findElement("name", "sdofnsdofk") 21 | errorResponse() 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /man/executeAsyncScriptOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{executeAsyncScriptOld} 4 | \alias{executeAsyncScriptOld} 5 | \title{executeAsyncScriptOld} 6 | \usage{ 7 | executeAsyncScriptOld(remDr, script, args = list(), replace = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{script}{character: The script to inject.} 14 | 15 | \item{args}{The arguments of the script as a list.} 16 | 17 | \item{replace}{logical: If TRUE any elements identify as web Elements 18 | are converted to such.} 19 | 20 | \item{...}{Additonal function arguments - Currently passes the 21 | \code{\link{retry}} argument.} 22 | } 23 | \value{ 24 | If replace is TRUE parses the response from the server for web 25 | Elements and converts as such. Otherwise the content returned is 26 | assummed to be a simple list. 27 | } 28 | \description{ 29 | \code{executeAsyncScriptOld} This function uses the old JSONwireprotocol 30 | end points. Inject a snippet of JavaScript into the page for 31 | asynchronous execution in the context of the currently selected 32 | frame. 33 | } 34 | \details{ 35 | The driver will pass a callback as the last argument to the snippet, 36 | and block until the callback is invoked. 37 | } 38 | \examples{ 39 | \dontrun{ 40 | # functions in this group are using the old JSONwireprotocol end points 41 | } 42 | 43 | } 44 | \seealso{ 45 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 46 | \code{\link{dismissAlertOld}}, 47 | \code{\link{executeScriptOld}}, 48 | \code{\link{getAlertTextOld}}, 49 | \code{\link{getWindowHandleOld}}, 50 | \code{\link{getWindowHandlesOld}}, 51 | \code{\link{getWindowPositionOld}}, 52 | \code{\link{getWindowSizeOld}}, 53 | \code{\link{maximizeWindowOld}}, 54 | \code{\link{sendAlertTextOld}}, 55 | \code{\link{setWindowPositionOld}}, 56 | \code{\link{setWindowSizeOld}} 57 | } 58 | 59 | -------------------------------------------------------------------------------- /man/executeScriptOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{executeScriptOld} 4 | \alias{executeScriptOld} 5 | \title{Execute JavaScript asynchronously on browser.} 6 | \usage{ 7 | executeScriptOld(remDr, script, args = list(), replace = TRUE, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{script}{character: The script to inject.} 14 | 15 | \item{args}{The arguments of the script as a list.} 16 | 17 | \item{replace}{logical: If TRUE any elements identify as web Elements 18 | are converted to such.} 19 | 20 | \item{...}{Additonal function arguments - Currently passes the 21 | \code{\link{retry}} argument.} 22 | } 23 | \value{ 24 | If replace is TRUE parses the response from the server for web 25 | Elements and converts as such. Otherwise the content returned is 26 | assummed to be a simple list. 27 | } 28 | \description{ 29 | \code{executeScriptOld} This function uses the old JSONwireprotocol end 30 | points. Inject a snippet of JavaScript into the page for execution 31 | in the context of the currently selected frame. The executed script 32 | is assumed to be synchronous and the result of evaluating the script 33 | will be returned. 34 | } 35 | \examples{ 36 | \dontrun{ 37 | # functions in this group are using the old JSONwireprotocol end points 38 | } 39 | 40 | } 41 | \seealso{ 42 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 43 | \code{\link{dismissAlertOld}}, 44 | \code{\link{executeAsyncScriptOld}}, 45 | \code{\link{getAlertTextOld}}, 46 | \code{\link{getWindowHandleOld}}, 47 | \code{\link{getWindowHandlesOld}}, 48 | \code{\link{getWindowPositionOld}}, 49 | \code{\link{getWindowSizeOld}}, 50 | \code{\link{maximizeWindowOld}}, 51 | \code{\link{sendAlertTextOld}}, 52 | \code{\link{setWindowPositionOld}}, 53 | \code{\link{setWindowSizeOld}} 54 | } 55 | 56 | -------------------------------------------------------------------------------- /man/forward.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/navigation.R, R/navigationDoc.R 3 | \name{forward} 4 | \alias{forward} 5 | \title{Navigate forwards} 6 | \usage{ 7 | forward(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{forward} Navigate forwards in the browser history, if possible. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | remDr <- remoteDr() 28 | remDr \%>\% go("http://www.google.com/ncr") 29 | 30 | # get the title 31 | remDr \%>\% getTitle 32 | 33 | # get the current page url 34 | remDr \%>\% getCurrentUrl 35 | 36 | # navigate 37 | remDr \%>\% go("http://www.bbc.co.uk") 38 | 39 | # go back 40 | remDr \%>\% (seleniumPipes::back) 41 | 42 | # go forward 43 | remDr \%>\% forward 44 | 45 | # refresh page 46 | remDr \%>\% refresh 47 | 48 | # close browser 49 | remDr \%>\% deleteSession 50 | } 51 | 52 | } 53 | \seealso{ 54 | Other navigation functions: \code{\link{back}}, 55 | \code{\link{getCurrentUrl}}, \code{\link{getTitle}}, 56 | \code{\link{go}}, \code{\link{refresh}} 57 | } 58 | 59 | -------------------------------------------------------------------------------- /man/fullscreenWindow.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{fullscreenWindow} 4 | \alias{fullscreenWindow} 5 | \title{Make current window full-screen} 6 | \usage{ 7 | fullscreenWindow(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{fullscreenWindow} The Fullscreen Window command invokes the window 24 | manager-specific “full screen” operation, if any, on the window 25 | containing the current top-level browsing context. This typically 26 | increases the window to the size of the physical display and can hide 27 | browser UI elements such as toolbars. 28 | } 29 | \examples{ 30 | \dontrun{ 31 | remDr <- remoteDr() 32 | remDr \%>\% getWindowHandle() # The current window handle 33 | remDr \%>\% getWindowHandles() # All windows in the session 34 | 35 | # Get the window position 36 | remDr \%>\% getWindowPosition 37 | 38 | # Some browsers are still using the old JSON wire end points 39 | remDr \%>\% getWindowPositionOld 40 | 41 | # Get the size of the window 42 | remDr \%>\% getWindowSize 43 | 44 | # Some browsers are still using the old JSON wire end points 45 | # remDr \%>\% getWindowSizeOld 46 | 47 | # Set the window size 48 | remDr \%>\% setWindowSize(500, 500) 49 | 50 | # Some browsers are still using the old JSON wire end points 51 | remDr \%>\% setWindowSizeOld(500, 500) 52 | 53 | # Set the position of the window 54 | remDr \%>\% setWindowPositionOld(400, 100) 55 | 56 | # Some browsers are still using the old JSON wire end points 57 | # remDr \%>\% setWindowPositionOld(400, 100) 58 | 59 | # Maximise the window 60 | remDr \%>\% maximizeWindow 61 | # Some browsers are still using the old JSON wire end points 62 | # remDr \%>\% maximizeWindowold() 63 | 64 | remDr \%>\% go("http://www.google.com/ncr") 65 | # search for the "R project" 66 | 67 | remDr \%>\% findElement("name", "q") \%>\% 68 | elementSendKeys("R project", key = "enter") 69 | 70 | webElem <- remDr \%>\% findElement("css", "h3.r a") 71 | 72 | remDr \%>\% deleteSession 73 | } 74 | } 75 | \seealso{ 76 | Other commandContexts functions: \code{\link{closeWindow}}, 77 | \code{\link{getWindowHandles}}, 78 | \code{\link{getWindowHandle}}, 79 | \code{\link{getWindowPosition}}, 80 | \code{\link{getWindowSize}}, 81 | \code{\link{maximizeWindow}}, 82 | \code{\link{setWindowPosition}}, 83 | \code{\link{setWindowSize}}, \code{\link{switchToFrame}}, 84 | \code{\link{switchToParentFrame}}, 85 | \code{\link{switchToWindow}} 86 | } 87 | 88 | -------------------------------------------------------------------------------- /man/getActiveElement.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementRetrieval.R, R/elementRetrievalDoc.R 3 | \name{getActiveElement} 4 | \alias{getActiveElement} 5 | \title{Get the element on the page that currently has focus.} 6 | \usage{ 7 | getActiveElement(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(wbElement(res$value, remDr)): An object of class 18 | "wElement" is invisibly returned. A webElement object see 19 | \code{\link{wbElement}}. This allows for chaining from this function 20 | to other functions that take such an object as an argument. See 21 | examples for further details. 22 | } 23 | \description{ 24 | \code{getActiveElement} Get the element on the page that currently has 25 | focus. The located element will be returned as a WebcElement object. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | remDr <- remoteDr() 30 | remDr \%>\% go("http://www.google.com/ncr") 31 | 32 | # find the search form query box and search for "R project" 33 | webElem <- remDr \%>\% findElement("name", "q") \%>\% 34 | elementSendKeys("R project", key = "enter") 35 | # click the first link hopefully should be www.r-project.org 36 | remDr \%>\% findElement("css", "h3.r a") \%>\% elementClick 37 | 38 | # get the navigation div 39 | navElem <- remDr \%>\% findElement("css", "div[role='navigation']") 40 | 41 | # find all the links in this div 42 | navLinks <- navElem \%>\% findElementsFromElement("css", "a") 43 | 44 | # check the links 45 | nLinks <- sapply(navLinks, function(x) x \%>\% getElementText) 46 | 47 | # compare with all links 48 | allLinks <- remDr \%>\% findElements("css", "a") 49 | aLinks <- sapply(allLinks, function(x) x \%>\% getElementText) 50 | 51 | # show the effect of searching for elements from element 52 | aLinks \%in\% nLinks 53 | 54 | remDr \%>\% deleteSession 55 | } 56 | 57 | } 58 | \seealso{ 59 | Other elementRetrieval functions: \code{\link{findElementFromElement}}, 60 | \code{\link{findElementsFromElement}}, 61 | \code{\link{findElements}}, \code{\link{findElement}} 62 | } 63 | 64 | -------------------------------------------------------------------------------- /man/getAlertText.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/userPrompts.R, R/userPromptsDoc.R 3 | \name{getAlertText} 4 | \alias{getAlertText} 5 | \title{Get alert text} 6 | \usage{ 7 | getAlertText(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | The text from the alert is returned. 18 | } 19 | \description{ 20 | \code{getAlertText} Get the text from a JavaScript alert. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | remDr <- remoteDr() 25 | remDr \%>\% go("https://www.google.com/ncr") \%>\% 26 | getTitle() 27 | sScript <- "setTimeout(function(){alert('HELLO')},1000); return 'DONE';" 28 | remDr \%>\% executeScript(sScript, args = list()) 29 | remDr \%>\% dismissAlert() 30 | 31 | sScript <- "setTimeout(function(){confirm('Press a button')},1000); 32 | return 'DONE';" 33 | remDr \%>\% executeScript(sScript, args = list()) 34 | remDr \%>\% acceptAlert() 35 | 36 | sScript <- "setTimeout(function(){confirm('Press a button')},1000); 37 | return 'DONE';" 38 | remDr \%>\% executeScript(sScript, args = list()) 39 | remDr \%>\% getAlertText() 40 | remDr \%>\% dismissAlert() 41 | 42 | 43 | sScript <- 44 | "setTimeout(function(){prompt('Please enter your name', '')},1000); 45 | return 'DONE';" 46 | remDr \%>\% executeScript(sScript, args = list()) 47 | remDr \%>\% getAlertText() 48 | remDr \%>\% sendAlertText("Buck Rogers?") 49 | 50 | remDr \%>\% deleteSession() 51 | 52 | } 53 | } 54 | \seealso{ 55 | Other userPrompts functions: \code{\link{acceptAlert}}, 56 | \code{\link{dismissAlert}}, \code{\link{sendAlertText}} 57 | } 58 | 59 | -------------------------------------------------------------------------------- /man/getAlertTextOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{getAlertTextOld} 4 | \alias{getAlertTextOld} 5 | \title{Get alert text} 6 | \usage{ 7 | getAlertTextOld(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | The alert text is returned as a string. 18 | } 19 | \description{ 20 | \code{getAlertTextOld} Get the text from a JavaScript alert. This uses 21 | the old JSONwireprotocol endpoints. 22 | } 23 | \examples{ 24 | \dontrun{ 25 | # functions in this group are using the old JSONwireprotocol end points 26 | } 27 | 28 | } 29 | \seealso{ 30 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 31 | \code{\link{dismissAlertOld}}, 32 | \code{\link{executeAsyncScriptOld}}, 33 | \code{\link{executeScriptOld}}, 34 | \code{\link{getWindowHandleOld}}, 35 | \code{\link{getWindowHandlesOld}}, 36 | \code{\link{getWindowPositionOld}}, 37 | \code{\link{getWindowSizeOld}}, 38 | \code{\link{maximizeWindowOld}}, 39 | \code{\link{sendAlertTextOld}}, 40 | \code{\link{setWindowPositionOld}}, 41 | \code{\link{setWindowSizeOld}} 42 | } 43 | 44 | -------------------------------------------------------------------------------- /man/getAllCookies.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cookies.R, R/cookiesDoc.R 3 | \name{getAllCookies} 4 | \alias{getAllCookies} 5 | \title{Get all current domain cookies} 6 | \usage{ 7 | getAllCookies(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | A list of all the cookies on the current domain are returned. 18 | These cookies have values as stipulated by the arguments given in 19 | \code{\link{addCookie}}. 20 | } 21 | \description{ 22 | \code{getAllCookies} Get all the cookies for the current domain. 23 | } 24 | \examples{ 25 | \dontrun{ 26 | # assume a server is running at default location 27 | remDr <- remoteDr() 28 | remDr \%>\% go("https://www.google.com/ncr") \%>\% 29 | getTitle() 30 | # get the cookies 31 | remDr \%>\% getCookie() 32 | # get a named cookie 33 | remDr \%>\% getCookie("NID") 34 | # add our own cookie 35 | remDr \%>\% addCookie(name = "myCookie", value = "12") 36 | # check its value 37 | remDr \%>\% getCookie("myCookie") 38 | # delete our cookie 39 | remDr \%>\% deleteCookie("myCookie") 40 | # check its deleted 41 | remDr \%>\% getCookie("myCookie") 42 | 43 | # delete all cookies 44 | remDr \%>\% getCookie() 45 | remDr \%>\% deleteAllCookies() \%>\% 46 | getCookie() 47 | 48 | remDr \%>\% deleteSession() 49 | } 50 | } 51 | \seealso{ 52 | Other cookies functions: \code{\link{addCookie}}, 53 | \code{\link{deleteAllCookies}}, 54 | \code{\link{deleteCookie}}, \code{\link{getNamedCookie}} 55 | } 56 | 57 | -------------------------------------------------------------------------------- /man/getCurrentUrl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/navigation.R, R/navigationDoc.R 3 | \name{getCurrentUrl} 4 | \alias{getCurrentUrl} 5 | \title{Retrieve the URL of the current page.} 6 | \usage{ 7 | getCurrentUrl(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | A character string is returned giving the current page URL. 18 | } 19 | \description{ 20 | \code{getCurrentUrl} Retrieve the URL of the current page. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | remDr <- remoteDr() 25 | remDr \%>\% go("http://www.google.com/ncr") 26 | 27 | # get the title 28 | remDr \%>\% getTitle 29 | 30 | # get the current page url 31 | remDr \%>\% getCurrentUrl 32 | 33 | # navigate 34 | remDr \%>\% go("http://www.bbc.co.uk") 35 | 36 | # go back 37 | remDr \%>\% (seleniumPipes::back) 38 | 39 | # go forward 40 | remDr \%>\% forward 41 | 42 | # refresh page 43 | remDr \%>\% refresh 44 | 45 | # close browser 46 | remDr \%>\% deleteSession 47 | } 48 | 49 | } 50 | \seealso{ 51 | Other navigation functions: \code{\link{back}}, 52 | \code{\link{forward}}, \code{\link{getTitle}}, 53 | \code{\link{go}}, \code{\link{refresh}} 54 | } 55 | 56 | -------------------------------------------------------------------------------- /man/getElementAttribute.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementState.R, R/elementStateDoc.R 3 | \name{getElementAttribute} 4 | \alias{getElementAttribute} 5 | \title{Get the value of an element's attribute.} 6 | \usage{ 7 | getElementAttribute(webElem, attribute, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{attribute}{The attribute to query as a character string.} 14 | 15 | \item{...}{Additonal function arguments - Currently passes the 16 | \code{\link{retry}} argument.} 17 | } 18 | \value{ 19 | The value of the attribute, or null if it is not set on the 20 | element. 21 | } 22 | \description{ 23 | \code{getElementAttribute} Get the value of an element's attribute. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | remDr <- remoteDr() 28 | remDr \%>\% go("http://www.google.com/ncr") 29 | 30 | # select the search box 31 | searchElem <- remDr \%>\% findElement("name", "q") 32 | 33 | # get the name of our element 34 | searchElem \%>\% getElementAttribute("name") 35 | 36 | # get the css background-color 37 | searchElem \%>\% getElementCssValue("background-color") 38 | blueScript <- "arguments[0].style.backgroundColor = 'blue';" 39 | remDr \%>\% executeScript(blueScript, list(searchElem)) 40 | searchElem \%>\% getElementCssValue("background-color") 41 | 42 | # get the javascript property 43 | # searchElem \%>\% getElementProperty("backgroundColor") 44 | 45 | # get dimensions 46 | searchElem \%>\% getElementRect 47 | 48 | searchElem \%>\% getElementTagName 49 | 50 | # get some text and return it 51 | remDr \%>\% go("http://r-project.org") 52 | remDr \%>\% findElement("css", "h1") \%>\% getElementText 53 | 54 | # close browser 55 | remDr \%>\% deleteSession 56 | } 57 | 58 | } 59 | \seealso{ 60 | Other elementState functions: \code{\link{getElementCssValue}}, 61 | \code{\link{getElementProperty}}, 62 | \code{\link{getElementRect}}, 63 | \code{\link{getElementTagName}}, 64 | \code{\link{getElementText}}, 65 | \code{\link{isElementEnabled}}, 66 | \code{\link{isElementSelected}} 67 | } 68 | 69 | -------------------------------------------------------------------------------- /man/getElementCssValue.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementState.R, R/elementStateDoc.R 3 | \name{getElementCssValue} 4 | \alias{getElementCssValue} 5 | \title{Query the value of an element's computed CSS property.} 6 | \usage{ 7 | getElementCssValue(webElem, propertyName, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{propertyName}{The property to query as a character string} 14 | 15 | \item{...}{Additonal function arguments - Currently passes the 16 | \code{\link{retry}} argument.} 17 | } 18 | \value{ 19 | The value of the specified CSS property. 20 | } 21 | \description{ 22 | \code{getElementCssValue} Query the value of an element's computed CSS 23 | property. The CSS property to query should be specified using the 24 | CSS property name, not the JavaScript property name (e.g. 25 | background-color instead of backgroundColor). 26 | } 27 | \examples{ 28 | \dontrun{ 29 | remDr <- remoteDr() 30 | remDr \%>\% go("http://www.google.com/ncr") 31 | 32 | # select the search box 33 | searchElem <- remDr \%>\% findElement("name", "q") 34 | 35 | # get the name of our element 36 | searchElem \%>\% getElementAttribute("name") 37 | 38 | # get the css background-color 39 | searchElem \%>\% getElementCssValue("background-color") 40 | blueScript <- "arguments[0].style.backgroundColor = 'blue';" 41 | remDr \%>\% executeScript(blueScript, list(searchElem)) 42 | searchElem \%>\% getElementCssValue("background-color") 43 | 44 | # get the javascript property 45 | # searchElem \%>\% getElementProperty("backgroundColor") 46 | 47 | # get dimensions 48 | searchElem \%>\% getElementRect 49 | 50 | searchElem \%>\% getElementTagName 51 | 52 | # get some text and return it 53 | remDr \%>\% go("http://r-project.org") 54 | remDr \%>\% findElement("css", "h1") \%>\% getElementText 55 | 56 | # close browser 57 | remDr \%>\% deleteSession 58 | } 59 | 60 | } 61 | \seealso{ 62 | Other elementState functions: \code{\link{getElementAttribute}}, 63 | \code{\link{getElementProperty}}, 64 | \code{\link{getElementRect}}, 65 | \code{\link{getElementTagName}}, 66 | \code{\link{getElementText}}, 67 | \code{\link{isElementEnabled}}, 68 | \code{\link{isElementSelected}} 69 | } 70 | 71 | -------------------------------------------------------------------------------- /man/getElementProperty.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementState.R, R/elementStateDoc.R 3 | \name{getElementProperty} 4 | \alias{getElementProperty} 5 | \title{Query the value of an elements property.} 6 | \usage{ 7 | getElementProperty(webElem, property, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{property}{The property to query as a character string} 14 | 15 | \item{...}{Additonal function arguments - Currently passes the 16 | \code{\link{retry}} argument.} 17 | } 18 | \value{ 19 | The value of the elements specified property. 20 | } 21 | \description{ 22 | \code{getElementProperty} Query the value of an elements property. 23 | } 24 | \examples{ 25 | \dontrun{ 26 | remDr <- remoteDr() 27 | remDr \%>\% go("http://www.google.com/ncr") 28 | 29 | # select the search box 30 | searchElem <- remDr \%>\% findElement("name", "q") 31 | 32 | # get the name of our element 33 | searchElem \%>\% getElementAttribute("name") 34 | 35 | # get the css background-color 36 | searchElem \%>\% getElementCssValue("background-color") 37 | blueScript <- "arguments[0].style.backgroundColor = 'blue';" 38 | remDr \%>\% executeScript(blueScript, list(searchElem)) 39 | searchElem \%>\% getElementCssValue("background-color") 40 | 41 | # get the javascript property 42 | # searchElem \%>\% getElementProperty("backgroundColor") 43 | 44 | # get dimensions 45 | searchElem \%>\% getElementRect 46 | 47 | searchElem \%>\% getElementTagName 48 | 49 | # get some text and return it 50 | remDr \%>\% go("http://r-project.org") 51 | remDr \%>\% findElement("css", "h1") \%>\% getElementText 52 | 53 | # close browser 54 | remDr \%>\% deleteSession 55 | } 56 | 57 | } 58 | \seealso{ 59 | Other elementState functions: \code{\link{getElementAttribute}}, 60 | \code{\link{getElementCssValue}}, 61 | \code{\link{getElementRect}}, 62 | \code{\link{getElementTagName}}, 63 | \code{\link{getElementText}}, 64 | \code{\link{isElementEnabled}}, 65 | \code{\link{isElementSelected}} 66 | } 67 | 68 | -------------------------------------------------------------------------------- /man/getElementRect.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementState.R, R/elementStateDoc.R 3 | \name{getElementRect} 4 | \alias{getElementRect} 5 | \title{Return the dimensions and coordinates of an element} 6 | \usage{ 7 | getElementRect(webElem, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | The returned value is a list including the following members: 18 | \describe{ 19 | \item{x}{X axis position of the top-left corner of the web element 20 | relative to the current browsing context’s document element in CSS 21 | reference pixels.} 22 | \item{y}{Y axis position of the top-left corner of the web element 23 | relative to the current browsing context’s document element in CSS 24 | reference pixels.} 25 | \item{height}{Height of the web element’s bounding rectangle in CSS 26 | reference pixels. } 27 | \item{width}{Width of the web element’s bounding rectangle in CSS 28 | reference pixels. } 29 | } 30 | } 31 | \description{ 32 | \code{getElementRect} The getElementRect fuinction returns the 33 | dimensions and coordinates of the given web element. 34 | } 35 | \examples{ 36 | \dontrun{ 37 | remDr <- remoteDr() 38 | remDr \%>\% go("http://www.google.com/ncr") 39 | 40 | # select the search box 41 | searchElem <- remDr \%>\% findElement("name", "q") 42 | 43 | # get the name of our element 44 | searchElem \%>\% getElementAttribute("name") 45 | 46 | # get the css background-color 47 | searchElem \%>\% getElementCssValue("background-color") 48 | blueScript <- "arguments[0].style.backgroundColor = 'blue';" 49 | remDr \%>\% executeScript(blueScript, list(searchElem)) 50 | searchElem \%>\% getElementCssValue("background-color") 51 | 52 | # get the javascript property 53 | # searchElem \%>\% getElementProperty("backgroundColor") 54 | 55 | # get dimensions 56 | searchElem \%>\% getElementRect 57 | 58 | searchElem \%>\% getElementTagName 59 | 60 | # get some text and return it 61 | remDr \%>\% go("http://r-project.org") 62 | remDr \%>\% findElement("css", "h1") \%>\% getElementText 63 | 64 | # close browser 65 | remDr \%>\% deleteSession 66 | } 67 | 68 | } 69 | \seealso{ 70 | Other elementState functions: \code{\link{getElementAttribute}}, 71 | \code{\link{getElementCssValue}}, 72 | \code{\link{getElementProperty}}, 73 | \code{\link{getElementTagName}}, 74 | \code{\link{getElementText}}, 75 | \code{\link{isElementEnabled}}, 76 | \code{\link{isElementSelected}} 77 | } 78 | 79 | -------------------------------------------------------------------------------- /man/getElementTagName.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementState.R, R/elementStateDoc.R 3 | \name{getElementTagName} 4 | \alias{getElementTagName} 5 | \title{Query for an element's tag name.} 6 | \usage{ 7 | getElementTagName(webElem, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | The element's tag name, as a lowercase character string. 18 | } 19 | \description{ 20 | \code{getElementTagName} Query for an element's tag name. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | remDr <- remoteDr() 25 | remDr \%>\% go("http://www.google.com/ncr") 26 | 27 | # select the search box 28 | searchElem <- remDr \%>\% findElement("name", "q") 29 | 30 | # get the name of our element 31 | searchElem \%>\% getElementAttribute("name") 32 | 33 | # get the css background-color 34 | searchElem \%>\% getElementCssValue("background-color") 35 | blueScript <- "arguments[0].style.backgroundColor = 'blue';" 36 | remDr \%>\% executeScript(blueScript, list(searchElem)) 37 | searchElem \%>\% getElementCssValue("background-color") 38 | 39 | # get the javascript property 40 | # searchElem \%>\% getElementProperty("backgroundColor") 41 | 42 | # get dimensions 43 | searchElem \%>\% getElementRect 44 | 45 | searchElem \%>\% getElementTagName 46 | 47 | # get some text and return it 48 | remDr \%>\% go("http://r-project.org") 49 | remDr \%>\% findElement("css", "h1") \%>\% getElementText 50 | 51 | # close browser 52 | remDr \%>\% deleteSession 53 | } 54 | 55 | } 56 | \seealso{ 57 | Other elementState functions: \code{\link{getElementAttribute}}, 58 | \code{\link{getElementCssValue}}, 59 | \code{\link{getElementProperty}}, 60 | \code{\link{getElementRect}}, 61 | \code{\link{getElementText}}, 62 | \code{\link{isElementEnabled}}, 63 | \code{\link{isElementSelected}} 64 | } 65 | 66 | -------------------------------------------------------------------------------- /man/getElementText.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementState.R, R/elementStateDoc.R 3 | \name{getElementText} 4 | \alias{getElementText} 5 | \title{Returns the visible text for the element.} 6 | \usage{ 7 | getElementText(webElem, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | The visible text for an element is returned as a character 18 | string. 19 | } 20 | \description{ 21 | \code{getElementText} Returns the visible text for the element. 22 | } 23 | \examples{ 24 | \dontrun{ 25 | remDr <- remoteDr() 26 | remDr \%>\% go("http://www.google.com/ncr") 27 | 28 | # select the search box 29 | searchElem <- remDr \%>\% findElement("name", "q") 30 | 31 | # get the name of our element 32 | searchElem \%>\% getElementAttribute("name") 33 | 34 | # get the css background-color 35 | searchElem \%>\% getElementCssValue("background-color") 36 | blueScript <- "arguments[0].style.backgroundColor = 'blue';" 37 | remDr \%>\% executeScript(blueScript, list(searchElem)) 38 | searchElem \%>\% getElementCssValue("background-color") 39 | 40 | # get the javascript property 41 | # searchElem \%>\% getElementProperty("backgroundColor") 42 | 43 | # get dimensions 44 | searchElem \%>\% getElementRect 45 | 46 | searchElem \%>\% getElementTagName 47 | 48 | # get some text and return it 49 | remDr \%>\% go("http://r-project.org") 50 | remDr \%>\% findElement("css", "h1") \%>\% getElementText 51 | 52 | # close browser 53 | remDr \%>\% deleteSession 54 | } 55 | 56 | } 57 | \seealso{ 58 | Other elementState functions: \code{\link{getElementAttribute}}, 59 | \code{\link{getElementCssValue}}, 60 | \code{\link{getElementProperty}}, 61 | \code{\link{getElementRect}}, 62 | \code{\link{getElementTagName}}, 63 | \code{\link{isElementEnabled}}, 64 | \code{\link{isElementSelected}} 65 | } 66 | 67 | -------------------------------------------------------------------------------- /man/getNamedCookie.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cookies.R, R/cookiesDoc.R 3 | \name{getNamedCookie} 4 | \alias{getNamedCookie} 5 | \title{Get a named cookie} 6 | \usage{ 7 | getNamedCookie(remDr, name = NULL, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{name}{character: The name of the cookie; may not be null or an 14 | empty string} 15 | 16 | \item{...}{Additonal function arguments - Currently passes the 17 | \code{\link{retry}} argument.} 18 | } 19 | \value{ 20 | A named cookies from the current domain is returned if it 21 | exists. These cookies have values as stipulated by the arguments 22 | given in \code{\link{addCookie}}. 23 | } 24 | \description{ 25 | \code{getNamedCookie} Get the cookie with a given name. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | # assume a server is running at default location 30 | remDr <- remoteDr() 31 | remDr \%>\% go("https://www.google.com/ncr") \%>\% 32 | getTitle() 33 | # get the cookies 34 | remDr \%>\% getCookie() 35 | # get a named cookie 36 | remDr \%>\% getCookie("NID") 37 | # add our own cookie 38 | remDr \%>\% addCookie(name = "myCookie", value = "12") 39 | # check its value 40 | remDr \%>\% getCookie("myCookie") 41 | # delete our cookie 42 | remDr \%>\% deleteCookie("myCookie") 43 | # check its deleted 44 | remDr \%>\% getCookie("myCookie") 45 | 46 | # delete all cookies 47 | remDr \%>\% getCookie() 48 | remDr \%>\% deleteAllCookies() \%>\% 49 | getCookie() 50 | 51 | remDr \%>\% deleteSession() 52 | } 53 | } 54 | \seealso{ 55 | Other cookies functions: \code{\link{addCookie}}, 56 | \code{\link{deleteAllCookies}}, 57 | \code{\link{deleteCookie}}, \code{\link{getAllCookies}} 58 | } 59 | 60 | -------------------------------------------------------------------------------- /man/getTimeouts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sessions.R, R/sessionsDoc.R 3 | \name{getTimeouts} 4 | \alias{getTimeouts} 5 | \title{Get amount of time that a particular type of operation can execute in.} 6 | \usage{ 7 | getTimeouts(remDr, type = "page load", ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{type}{The type of operation to set the timeout for. Valid values 14 | are: "script" for script timeouts, "implicit" for modifying the 15 | implicit wait timeout and "page load" for setting a page load 16 | timeout.} 17 | 18 | \item{...}{Additonal function arguments - Currently passes the 19 | \code{\link{retry}} argument.} 20 | } 21 | \value{ 22 | ret2 : res$value NEED TO FILL IN specifics for each function 23 | } 24 | \description{ 25 | \code{getTimeouts} The Get Timeout command gets timeouts associated with 26 | the current session. 27 | } 28 | \examples{ 29 | \dontrun{ 30 | # start a driver without opening a browser 31 | remDr <- remoteDr(newSession = FALSE) 32 | 33 | # open a broswer 34 | remDr \%>\% newSession 35 | 36 | # set timeout on waiting for elements 37 | remDr \%>\% setTimeout(type = "implicit", 5000) 38 | 39 | # close Session 40 | remDr \%>\% deleteSession 41 | 42 | } 43 | 44 | } 45 | \seealso{ 46 | Other sessions functions: \code{\link{deleteSession}}, 47 | \code{\link{newSession}}, \code{\link{setTimeouts}}, 48 | \code{\link{status}} 49 | } 50 | 51 | -------------------------------------------------------------------------------- /man/getTitle.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/navigation.R, R/navigationDoc.R 3 | \name{getTitle} 4 | \alias{getTitle} 5 | \title{Get the current page title.} 6 | \usage{ 7 | getTitle(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | The title of the current page is returned as a character string. 18 | } 19 | \description{ 20 | \code{getTitle} Get the current page title. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | remDr <- remoteDr() 25 | remDr \%>\% go("http://www.google.com/ncr") 26 | 27 | # get the title 28 | remDr \%>\% getTitle 29 | 30 | # get the current page url 31 | remDr \%>\% getCurrentUrl 32 | 33 | # navigate 34 | remDr \%>\% go("http://www.bbc.co.uk") 35 | 36 | # go back 37 | remDr \%>\% (seleniumPipes::back) 38 | 39 | # go forward 40 | remDr \%>\% forward 41 | 42 | # refresh page 43 | remDr \%>\% refresh 44 | 45 | # close browser 46 | remDr \%>\% deleteSession 47 | } 48 | 49 | } 50 | \seealso{ 51 | Other navigation functions: \code{\link{back}}, 52 | \code{\link{forward}}, \code{\link{getCurrentUrl}}, 53 | \code{\link{go}}, \code{\link{refresh}} 54 | } 55 | 56 | -------------------------------------------------------------------------------- /man/getWindowHandle.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{getWindowHandle} 4 | \alias{getWindowHandle} 5 | \title{get current window handle} 6 | \usage{ 7 | getWindowHandle(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | Returns a string which is the "handle" for the current window. 18 | } 19 | \description{ 20 | \code{getWindowHandle} Retrieve the current window handle. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | remDr <- remoteDr() 25 | remDr \%>\% getWindowHandle() # The current window handle 26 | remDr \%>\% getWindowHandles() # All windows in the session 27 | 28 | # Get the window position 29 | remDr \%>\% getWindowPosition 30 | 31 | # Some browsers are still using the old JSON wire end points 32 | remDr \%>\% getWindowPositionOld 33 | 34 | # Get the size of the window 35 | remDr \%>\% getWindowSize 36 | 37 | # Some browsers are still using the old JSON wire end points 38 | # remDr \%>\% getWindowSizeOld 39 | 40 | # Set the window size 41 | remDr \%>\% setWindowSize(500, 500) 42 | 43 | # Some browsers are still using the old JSON wire end points 44 | remDr \%>\% setWindowSizeOld(500, 500) 45 | 46 | # Set the position of the window 47 | remDr \%>\% setWindowPositionOld(400, 100) 48 | 49 | # Some browsers are still using the old JSON wire end points 50 | # remDr \%>\% setWindowPositionOld(400, 100) 51 | 52 | # Maximise the window 53 | remDr \%>\% maximizeWindow 54 | # Some browsers are still using the old JSON wire end points 55 | # remDr \%>\% maximizeWindowold() 56 | 57 | remDr \%>\% go("http://www.google.com/ncr") 58 | # search for the "R project" 59 | 60 | remDr \%>\% findElement("name", "q") \%>\% 61 | elementSendKeys("R project", key = "enter") 62 | 63 | webElem <- remDr \%>\% findElement("css", "h3.r a") 64 | 65 | remDr \%>\% deleteSession 66 | } 67 | } 68 | \seealso{ 69 | Other commandContexts functions: \code{\link{closeWindow}}, 70 | \code{\link{fullscreenWindow}}, 71 | \code{\link{getWindowHandles}}, 72 | \code{\link{getWindowPosition}}, 73 | \code{\link{getWindowSize}}, 74 | \code{\link{maximizeWindow}}, 75 | \code{\link{setWindowPosition}}, 76 | \code{\link{setWindowSize}}, \code{\link{switchToFrame}}, 77 | \code{\link{switchToParentFrame}}, 78 | \code{\link{switchToWindow}} 79 | } 80 | 81 | -------------------------------------------------------------------------------- /man/getWindowHandleOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{getWindowHandleOld} 4 | \alias{getWindowHandleOld} 5 | \title{Retrieve the current window handle.} 6 | \usage{ 7 | getWindowHandleOld(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | Returns a string which is the "handle" for the current window. 18 | } 19 | \description{ 20 | \code{getWindowHandleOld} Retrieve the current window handle. Uses the 21 | old JSONwireprotocol end points 22 | } 23 | \examples{ 24 | \dontrun{ 25 | # functions in this group are using the old JSONwireprotocol end points 26 | } 27 | 28 | } 29 | \seealso{ 30 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 31 | \code{\link{dismissAlertOld}}, 32 | \code{\link{executeAsyncScriptOld}}, 33 | \code{\link{executeScriptOld}}, 34 | \code{\link{getAlertTextOld}}, 35 | \code{\link{getWindowHandlesOld}}, 36 | \code{\link{getWindowPositionOld}}, 37 | \code{\link{getWindowSizeOld}}, 38 | \code{\link{maximizeWindowOld}}, 39 | \code{\link{sendAlertTextOld}}, 40 | \code{\link{setWindowPositionOld}}, 41 | \code{\link{setWindowSizeOld}} 42 | } 43 | 44 | -------------------------------------------------------------------------------- /man/getWindowHandles.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{getWindowHandles} 4 | \alias{getWindowHandles} 5 | \title{Get all window handles.} 6 | \usage{ 7 | getWindowHandles(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | Returns a list of windows handles. Each element of the list is a 18 | string. The order window handles are returned is arbitrary. 19 | } 20 | \description{ 21 | \code{getWindowHandles} Retrieve the list of all window handles available 22 | to the session. 23 | } 24 | \examples{ 25 | \dontrun{ 26 | remDr <- remoteDr() 27 | remDr \%>\% getWindowHandle() # The current window handle 28 | remDr \%>\% getWindowHandles() # All windows in the session 29 | 30 | # Get the window position 31 | remDr \%>\% getWindowPosition 32 | 33 | # Some browsers are still using the old JSON wire end points 34 | remDr \%>\% getWindowPositionOld 35 | 36 | # Get the size of the window 37 | remDr \%>\% getWindowSize 38 | 39 | # Some browsers are still using the old JSON wire end points 40 | # remDr \%>\% getWindowSizeOld 41 | 42 | # Set the window size 43 | remDr \%>\% setWindowSize(500, 500) 44 | 45 | # Some browsers are still using the old JSON wire end points 46 | remDr \%>\% setWindowSizeOld(500, 500) 47 | 48 | # Set the position of the window 49 | remDr \%>\% setWindowPositionOld(400, 100) 50 | 51 | # Some browsers are still using the old JSON wire end points 52 | # remDr \%>\% setWindowPositionOld(400, 100) 53 | 54 | # Maximise the window 55 | remDr \%>\% maximizeWindow 56 | # Some browsers are still using the old JSON wire end points 57 | # remDr \%>\% maximizeWindowold() 58 | 59 | remDr \%>\% go("http://www.google.com/ncr") 60 | # search for the "R project" 61 | 62 | remDr \%>\% findElement("name", "q") \%>\% 63 | elementSendKeys("R project", key = "enter") 64 | 65 | webElem <- remDr \%>\% findElement("css", "h3.r a") 66 | 67 | remDr \%>\% deleteSession 68 | } 69 | } 70 | \seealso{ 71 | Other commandContexts functions: \code{\link{closeWindow}}, 72 | \code{\link{fullscreenWindow}}, 73 | \code{\link{getWindowHandle}}, 74 | \code{\link{getWindowPosition}}, 75 | \code{\link{getWindowSize}}, 76 | \code{\link{maximizeWindow}}, 77 | \code{\link{setWindowPosition}}, 78 | \code{\link{setWindowSize}}, \code{\link{switchToFrame}}, 79 | \code{\link{switchToParentFrame}}, 80 | \code{\link{switchToWindow}} 81 | } 82 | 83 | -------------------------------------------------------------------------------- /man/getWindowHandlesOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{getWindowHandlesOld} 4 | \alias{getWindowHandlesOld} 5 | \title{Get all window handles.} 6 | \usage{ 7 | getWindowHandlesOld(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | Returns a list of windows handles. Each element of the list is 18 | a string. The order window handles are returned is arbitrary. 19 | } 20 | \description{ 21 | \code{getWindowHandlesOld} Uses the old JSONwireprotocol end points. 22 | Retrieve the list of all window handles available to the session. 23 | } 24 | \examples{ 25 | \dontrun{ 26 | # functions in this group are using the old JSONwireprotocol end points 27 | } 28 | 29 | } 30 | \seealso{ 31 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 32 | \code{\link{dismissAlertOld}}, 33 | \code{\link{executeAsyncScriptOld}}, 34 | \code{\link{executeScriptOld}}, 35 | \code{\link{getAlertTextOld}}, 36 | \code{\link{getWindowHandleOld}}, 37 | \code{\link{getWindowPositionOld}}, 38 | \code{\link{getWindowSizeOld}}, 39 | \code{\link{maximizeWindowOld}}, 40 | \code{\link{sendAlertTextOld}}, 41 | \code{\link{setWindowPositionOld}}, 42 | \code{\link{setWindowSizeOld}} 43 | } 44 | 45 | -------------------------------------------------------------------------------- /man/getWindowPosition.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{getWindowPosition} 4 | \alias{getWindowPosition} 5 | \title{Get current window position} 6 | \usage{ 7 | getWindowPosition(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | Returns a list which contains the x coordinate to position the 18 | window at, relative to the upper left corner of the screen and the Y 19 | coordinate to position the window at, relative to the upper left 20 | corner of the screen 21 | } 22 | \description{ 23 | \code{getWindowPosition} The Get Window Position command returns the 24 | position on the screen of the operating system window corresponding 25 | to the current top-level browsing context. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | remDr <- remoteDr() 30 | remDr \%>\% getWindowHandle() # The current window handle 31 | remDr \%>\% getWindowHandles() # All windows in the session 32 | 33 | # Get the window position 34 | remDr \%>\% getWindowPosition 35 | 36 | # Some browsers are still using the old JSON wire end points 37 | remDr \%>\% getWindowPositionOld 38 | 39 | # Get the size of the window 40 | remDr \%>\% getWindowSize 41 | 42 | # Some browsers are still using the old JSON wire end points 43 | # remDr \%>\% getWindowSizeOld 44 | 45 | # Set the window size 46 | remDr \%>\% setWindowSize(500, 500) 47 | 48 | # Some browsers are still using the old JSON wire end points 49 | remDr \%>\% setWindowSizeOld(500, 500) 50 | 51 | # Set the position of the window 52 | remDr \%>\% setWindowPositionOld(400, 100) 53 | 54 | # Some browsers are still using the old JSON wire end points 55 | # remDr \%>\% setWindowPositionOld(400, 100) 56 | 57 | # Maximise the window 58 | remDr \%>\% maximizeWindow 59 | # Some browsers are still using the old JSON wire end points 60 | # remDr \%>\% maximizeWindowold() 61 | 62 | remDr \%>\% go("http://www.google.com/ncr") 63 | # search for the "R project" 64 | 65 | remDr \%>\% findElement("name", "q") \%>\% 66 | elementSendKeys("R project", key = "enter") 67 | 68 | webElem <- remDr \%>\% findElement("css", "h3.r a") 69 | 70 | remDr \%>\% deleteSession 71 | } 72 | } 73 | \seealso{ 74 | Other commandContexts functions: \code{\link{closeWindow}}, 75 | \code{\link{fullscreenWindow}}, 76 | \code{\link{getWindowHandles}}, 77 | \code{\link{getWindowHandle}}, 78 | \code{\link{getWindowSize}}, 79 | \code{\link{maximizeWindow}}, 80 | \code{\link{setWindowPosition}}, 81 | \code{\link{setWindowSize}}, \code{\link{switchToFrame}}, 82 | \code{\link{switchToParentFrame}}, 83 | \code{\link{switchToWindow}} 84 | } 85 | 86 | -------------------------------------------------------------------------------- /man/getWindowPositionOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{getWindowPositionOld} 4 | \alias{getWindowPositionOld} 5 | \title{Get window position} 6 | \usage{ 7 | getWindowPositionOld(remDr, handle = "current", ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{handle}{Handle of the window to query. If handle = "current" 14 | (the default) the current window is used.} 15 | 16 | \item{...}{Additonal function arguments - Currently passes the 17 | \code{\link{retry}} argument.} 18 | } 19 | \value{ 20 | Returns a list which contains the x coordinate to position the 21 | window at, relative to the upper left corner of the screen and the 22 | Y coordinate to position the window at, relative to the upper left 23 | corner of the screen 24 | } 25 | \description{ 26 | \code{getWindowPositionOld} Get the position of the specified window. 27 | Uses the old JSONwireprotocol end points. 28 | } 29 | \examples{ 30 | \dontrun{ 31 | # functions in this group are using the old JSONwireprotocol end points 32 | } 33 | 34 | } 35 | \seealso{ 36 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 37 | \code{\link{dismissAlertOld}}, 38 | \code{\link{executeAsyncScriptOld}}, 39 | \code{\link{executeScriptOld}}, 40 | \code{\link{getAlertTextOld}}, 41 | \code{\link{getWindowHandleOld}}, 42 | \code{\link{getWindowHandlesOld}}, 43 | \code{\link{getWindowSizeOld}}, 44 | \code{\link{maximizeWindowOld}}, 45 | \code{\link{sendAlertTextOld}}, 46 | \code{\link{setWindowPositionOld}}, 47 | \code{\link{setWindowSizeOld}} 48 | } 49 | 50 | -------------------------------------------------------------------------------- /man/getWindowSize.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{getWindowSize} 4 | \alias{getWindowSize} 5 | \title{getWindowSize} 6 | \usage{ 7 | getWindowSize(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | The width and height of the window are returned as elements in 18 | a list. 19 | } 20 | \description{ 21 | \code{getWindowSize} 22 | } 23 | \examples{ 24 | \dontrun{ 25 | remDr <- remoteDr() 26 | remDr \%>\% getWindowHandle() # The current window handle 27 | remDr \%>\% getWindowHandles() # All windows in the session 28 | 29 | # Get the window position 30 | remDr \%>\% getWindowPosition 31 | 32 | # Some browsers are still using the old JSON wire end points 33 | remDr \%>\% getWindowPositionOld 34 | 35 | # Get the size of the window 36 | remDr \%>\% getWindowSize 37 | 38 | # Some browsers are still using the old JSON wire end points 39 | # remDr \%>\% getWindowSizeOld 40 | 41 | # Set the window size 42 | remDr \%>\% setWindowSize(500, 500) 43 | 44 | # Some browsers are still using the old JSON wire end points 45 | remDr \%>\% setWindowSizeOld(500, 500) 46 | 47 | # Set the position of the window 48 | remDr \%>\% setWindowPositionOld(400, 100) 49 | 50 | # Some browsers are still using the old JSON wire end points 51 | # remDr \%>\% setWindowPositionOld(400, 100) 52 | 53 | # Maximise the window 54 | remDr \%>\% maximizeWindow 55 | # Some browsers are still using the old JSON wire end points 56 | # remDr \%>\% maximizeWindowold() 57 | 58 | remDr \%>\% go("http://www.google.com/ncr") 59 | # search for the "R project" 60 | 61 | remDr \%>\% findElement("name", "q") \%>\% 62 | elementSendKeys("R project", key = "enter") 63 | 64 | webElem <- remDr \%>\% findElement("css", "h3.r a") 65 | 66 | remDr \%>\% deleteSession 67 | } 68 | } 69 | \seealso{ 70 | Other commandContexts functions: \code{\link{closeWindow}}, 71 | \code{\link{fullscreenWindow}}, 72 | \code{\link{getWindowHandles}}, 73 | \code{\link{getWindowHandle}}, 74 | \code{\link{getWindowPosition}}, 75 | \code{\link{maximizeWindow}}, 76 | \code{\link{setWindowPosition}}, 77 | \code{\link{setWindowSize}}, \code{\link{switchToFrame}}, 78 | \code{\link{switchToParentFrame}}, 79 | \code{\link{switchToWindow}} 80 | } 81 | 82 | -------------------------------------------------------------------------------- /man/getWindowSizeOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{getWindowSizeOld} 4 | \alias{getWindowSizeOld} 5 | \title{Get window size} 6 | \usage{ 7 | getWindowSizeOld(remDr, handle = "current", ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{handle}{Handle of the window to query. If handle = "current" 14 | (the default) the current window is used.} 15 | 16 | \item{...}{Additonal function arguments - Currently passes the 17 | \code{\link{retry}} argument.} 18 | } 19 | \value{ 20 | The width and height of the window are returned as elements in 21 | a list. 22 | } 23 | \description{ 24 | \code{getWindowSizeOld} Get the size of the specified window. Uses the 25 | old JSONwireprotocol end points. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | # functions in this group are using the old JSONwireprotocol end points 30 | } 31 | 32 | } 33 | \seealso{ 34 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 35 | \code{\link{dismissAlertOld}}, 36 | \code{\link{executeAsyncScriptOld}}, 37 | \code{\link{executeScriptOld}}, 38 | \code{\link{getAlertTextOld}}, 39 | \code{\link{getWindowHandleOld}}, 40 | \code{\link{getWindowHandlesOld}}, 41 | \code{\link{getWindowPositionOld}}, 42 | \code{\link{maximizeWindowOld}}, 43 | \code{\link{sendAlertTextOld}}, 44 | \code{\link{setWindowPositionOld}}, 45 | \code{\link{setWindowSizeOld}} 46 | } 47 | 48 | -------------------------------------------------------------------------------- /man/go.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/navigation.R, R/navigationDoc.R 3 | \name{go} 4 | \alias{go} 5 | \title{Navigate to a new URL.} 6 | \usage{ 7 | go(remDr, url, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{url}{The URL to navigate to.} 14 | 15 | \item{...}{Additonal function arguments - Currently passes the 16 | \code{\link{retry}} argument.} 17 | } 18 | \value{ 19 | invisible(remDr): An object of class "rDriver" is invisibly 20 | returned. A remote driver object see \code{\link{remoteDr}}. This 21 | allows for chaining from this function to other functions that take 22 | such an object as an argument. See examples for further details. 23 | } 24 | \description{ 25 | \code{go} Navigate to a new URL. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | remDr <- remoteDr() 30 | remDr \%>\% go("http://www.google.com/ncr") 31 | 32 | # get the title 33 | remDr \%>\% getTitle 34 | 35 | # get the current page url 36 | remDr \%>\% getCurrentUrl 37 | 38 | # navigate 39 | remDr \%>\% go("http://www.bbc.co.uk") 40 | 41 | # go back 42 | remDr \%>\% (seleniumPipes::back) 43 | 44 | # go forward 45 | remDr \%>\% forward 46 | 47 | # refresh page 48 | remDr \%>\% refresh 49 | 50 | # close browser 51 | remDr \%>\% deleteSession 52 | } 53 | 54 | } 55 | \seealso{ 56 | Other navigation functions: \code{\link{back}}, 57 | \code{\link{forward}}, \code{\link{getCurrentUrl}}, 58 | \code{\link{getTitle}}, \code{\link{refresh}} 59 | } 60 | 61 | -------------------------------------------------------------------------------- /man/isElementEnabled.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementState.R, R/elementStateDoc.R 3 | \name{isElementEnabled} 4 | \alias{isElementEnabled} 5 | \title{Determine if an element is currently enabled.} 6 | \usage{ 7 | isElementEnabled(webElem, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | A logical value is returned indicating whether the elemnent is 18 | enabled. 19 | } 20 | \description{ 21 | \code{isElementEnabled} Determine if an element is currently enabled. 22 | } 23 | \examples{ 24 | \dontrun{ 25 | remDr <- remoteDr() 26 | remDr \%>\% go("http://www.google.com/ncr") 27 | 28 | # select the search box 29 | searchElem <- remDr \%>\% findElement("name", "q") 30 | 31 | # get the name of our element 32 | searchElem \%>\% getElementAttribute("name") 33 | 34 | # get the css background-color 35 | searchElem \%>\% getElementCssValue("background-color") 36 | blueScript <- "arguments[0].style.backgroundColor = 'blue';" 37 | remDr \%>\% executeScript(blueScript, list(searchElem)) 38 | searchElem \%>\% getElementCssValue("background-color") 39 | 40 | # get the javascript property 41 | # searchElem \%>\% getElementProperty("backgroundColor") 42 | 43 | # get dimensions 44 | searchElem \%>\% getElementRect 45 | 46 | searchElem \%>\% getElementTagName 47 | 48 | # get some text and return it 49 | remDr \%>\% go("http://r-project.org") 50 | remDr \%>\% findElement("css", "h1") \%>\% getElementText 51 | 52 | # close browser 53 | remDr \%>\% deleteSession 54 | } 55 | 56 | } 57 | \seealso{ 58 | Other elementState functions: \code{\link{getElementAttribute}}, 59 | \code{\link{getElementCssValue}}, 60 | \code{\link{getElementProperty}}, 61 | \code{\link{getElementRect}}, 62 | \code{\link{getElementTagName}}, 63 | \code{\link{getElementText}}, 64 | \code{\link{isElementSelected}} 65 | } 66 | 67 | -------------------------------------------------------------------------------- /man/isElementSelected.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/elementState.R, R/elementStateDoc.R 3 | \name{isElementSelected} 4 | \alias{isElementSelected} 5 | \title{Determine if an element is currently selected.} 6 | \usage{ 7 | isElementSelected(webElem, ...) 8 | } 9 | \arguments{ 10 | \item{webElem}{An object of class "wElement". A web Element object see 11 | \code{\link{wbElement}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | A logical value is returned indicating whether the elemnent is 18 | selected. 19 | } 20 | \description{ 21 | \code{isElementSelected} Determines if an OPTION element, or an INPUT 22 | element of type checkbox or radiobutton is currently selected. 23 | } 24 | \examples{ 25 | \dontrun{ 26 | remDr <- remoteDr() 27 | remDr \%>\% go("http://www.google.com/ncr") 28 | 29 | # select the search box 30 | searchElem <- remDr \%>\% findElement("name", "q") 31 | 32 | # get the name of our element 33 | searchElem \%>\% getElementAttribute("name") 34 | 35 | # get the css background-color 36 | searchElem \%>\% getElementCssValue("background-color") 37 | blueScript <- "arguments[0].style.backgroundColor = 'blue';" 38 | remDr \%>\% executeScript(blueScript, list(searchElem)) 39 | searchElem \%>\% getElementCssValue("background-color") 40 | 41 | # get the javascript property 42 | # searchElem \%>\% getElementProperty("backgroundColor") 43 | 44 | # get dimensions 45 | searchElem \%>\% getElementRect 46 | 47 | searchElem \%>\% getElementTagName 48 | 49 | # get some text and return it 50 | remDr \%>\% go("http://r-project.org") 51 | remDr \%>\% findElement("css", "h1") \%>\% getElementText 52 | 53 | # close browser 54 | remDr \%>\% deleteSession 55 | } 56 | 57 | } 58 | \seealso{ 59 | Other elementState functions: \code{\link{getElementAttribute}}, 60 | \code{\link{getElementCssValue}}, 61 | \code{\link{getElementProperty}}, 62 | \code{\link{getElementRect}}, 63 | \code{\link{getElementTagName}}, 64 | \code{\link{getElementText}}, 65 | \code{\link{isElementEnabled}} 66 | } 67 | 68 | -------------------------------------------------------------------------------- /man/maximizeWindow.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{maximizeWindow} 4 | \alias{maximizeWindow} 5 | \title{Maximize the current window.} 6 | \usage{ 7 | maximizeWindow(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{maximizeWindow} Maximize the current if not already maximized. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | remDr <- remoteDr() 28 | remDr \%>\% getWindowHandle() # The current window handle 29 | remDr \%>\% getWindowHandles() # All windows in the session 30 | 31 | # Get the window position 32 | remDr \%>\% getWindowPosition 33 | 34 | # Some browsers are still using the old JSON wire end points 35 | remDr \%>\% getWindowPositionOld 36 | 37 | # Get the size of the window 38 | remDr \%>\% getWindowSize 39 | 40 | # Some browsers are still using the old JSON wire end points 41 | # remDr \%>\% getWindowSizeOld 42 | 43 | # Set the window size 44 | remDr \%>\% setWindowSize(500, 500) 45 | 46 | # Some browsers are still using the old JSON wire end points 47 | remDr \%>\% setWindowSizeOld(500, 500) 48 | 49 | # Set the position of the window 50 | remDr \%>\% setWindowPositionOld(400, 100) 51 | 52 | # Some browsers are still using the old JSON wire end points 53 | # remDr \%>\% setWindowPositionOld(400, 100) 54 | 55 | # Maximise the window 56 | remDr \%>\% maximizeWindow 57 | # Some browsers are still using the old JSON wire end points 58 | # remDr \%>\% maximizeWindowold() 59 | 60 | remDr \%>\% go("http://www.google.com/ncr") 61 | # search for the "R project" 62 | 63 | remDr \%>\% findElement("name", "q") \%>\% 64 | elementSendKeys("R project", key = "enter") 65 | 66 | webElem <- remDr \%>\% findElement("css", "h3.r a") 67 | 68 | remDr \%>\% deleteSession 69 | } 70 | } 71 | \seealso{ 72 | Other commandContexts functions: \code{\link{closeWindow}}, 73 | \code{\link{fullscreenWindow}}, 74 | \code{\link{getWindowHandles}}, 75 | \code{\link{getWindowHandle}}, 76 | \code{\link{getWindowPosition}}, 77 | \code{\link{getWindowSize}}, 78 | \code{\link{setWindowPosition}}, 79 | \code{\link{setWindowSize}}, \code{\link{switchToFrame}}, 80 | \code{\link{switchToParentFrame}}, 81 | \code{\link{switchToWindow}} 82 | } 83 | 84 | -------------------------------------------------------------------------------- /man/maximizeWindowOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{maximizeWindowOld} 4 | \alias{maximizeWindowOld} 5 | \title{Maximize the current window.} 6 | \usage{ 7 | maximizeWindowOld(remDr, handle = "current", ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{handle}{Handle of the window to query. If handle = "current" 14 | (the default) the current window is used.} 15 | 16 | \item{...}{Additonal function arguments - Currently passes the 17 | \code{\link{retry}} argument.} 18 | } 19 | \value{ 20 | invisible(remDr): An object of class "rDriver" is invisibly 21 | returned. A remote driver object see \code{\link{remoteDr}}. This 22 | allows for chaining from this function to other functions that take 23 | such an object as an argument. See examples for further details. 24 | } 25 | \description{ 26 | \code{maximizeWindowOld} Maximize the specified window if not already 27 | maximized. 28 | } 29 | \examples{ 30 | \dontrun{ 31 | # functions in this group are using the old JSONwireprotocol end points 32 | } 33 | 34 | } 35 | \seealso{ 36 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 37 | \code{\link{dismissAlertOld}}, 38 | \code{\link{executeAsyncScriptOld}}, 39 | \code{\link{executeScriptOld}}, 40 | \code{\link{getAlertTextOld}}, 41 | \code{\link{getWindowHandleOld}}, 42 | \code{\link{getWindowHandlesOld}}, 43 | \code{\link{getWindowPositionOld}}, 44 | \code{\link{getWindowSizeOld}}, 45 | \code{\link{sendAlertTextOld}}, 46 | \code{\link{setWindowPositionOld}}, 47 | \code{\link{setWindowSizeOld}} 48 | } 49 | 50 | -------------------------------------------------------------------------------- /man/newSession.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sessions.R, R/sessionsDoc.R 3 | \name{newSession} 4 | \alias{newSession} 5 | \title{Create a new session.} 6 | \usage{ 7 | newSession(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{newSession} The server should attempt to create a session that 24 | most closely matches the desired and required capabilities. Required 25 | capabilities have higher priority than desired capabilities and must 26 | be set for the session to be created. 27 | } 28 | \examples{ 29 | \dontrun{ 30 | # start a driver without opening a browser 31 | remDr <- remoteDr(newSession = FALSE) 32 | 33 | # open a broswer 34 | remDr \%>\% newSession 35 | 36 | # set timeout on waiting for elements 37 | remDr \%>\% setTimeout(type = "implicit", 5000) 38 | 39 | # close Session 40 | remDr \%>\% deleteSession 41 | 42 | } 43 | 44 | } 45 | \seealso{ 46 | Other sessions functions: \code{\link{deleteSession}}, 47 | \code{\link{getTimeouts}}, \code{\link{setTimeouts}}, 48 | \code{\link{status}} 49 | } 50 | 51 | -------------------------------------------------------------------------------- /man/performActions.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/interactions.R, R/interactionsDoc.R 3 | \name{performActions} 4 | \alias{performActions} 5 | \title{Not currently implemented} 6 | \usage{ 7 | performActions(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{performActions} The Perform Actions command allows you to create 24 | sequential interactions that can be sent over from the local end to 25 | the remote end. This type of interactions allow emulations like drag 26 | and drop. 27 | } 28 | \examples{ 29 | \dontrun{ 30 | # functions not currently implemented 31 | } 32 | 33 | } 34 | \seealso{ 35 | Other interactions functions: \code{\link{releasingActions}} 36 | } 37 | 38 | -------------------------------------------------------------------------------- /man/pipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{\%>\%} 4 | \alias{\%>\%} 5 | \title{Pipe operator} 6 | \usage{ 7 | lhs \%>\% rhs 8 | } 9 | \description{ 10 | See \code{\link[magrittr]{\%>\%}} for more details. 11 | } 12 | \keyword{internal} 13 | 14 | -------------------------------------------------------------------------------- /man/queryDriver.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/init.R 3 | \name{queryDriver} 4 | \alias{queryDriver} 5 | \title{Send a query to remote Driver.} 6 | \usage{ 7 | queryDriver(verb = GET, url, source, drvID, ...) 8 | } 9 | \arguments{ 10 | \item{verb}{The http method to use. See \code{\link{VERB}}} 11 | 12 | \item{url}{The url of the remote server endpoint.} 13 | 14 | \item{source}{The name of the seleniumPipes function that called 15 | queryDriver.} 16 | 17 | \item{drvID}{The driver id of the session as given by an object of 18 | class "remoteDr"} 19 | 20 | \item{...}{additonal arguments} 21 | } 22 | \value{ 23 | The contents of the response from the remote server. See 24 | \code{\link{content}} for details. 25 | } 26 | \description{ 27 | \code{queryDriver} A function to send a query to a remote driver. 28 | Intended for seleniumPipes internal use mainly. 29 | } 30 | \examples{ 31 | \dontrun{ 32 | # internal method 33 | } 34 | 35 | } 36 | 37 | -------------------------------------------------------------------------------- /man/refresh.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/navigation.R, R/navigationDoc.R 3 | \name{refresh} 4 | \alias{refresh} 5 | \title{Refresh the current page.} 6 | \usage{ 7 | refresh(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{refresh} Refresh the current page. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | remDr <- remoteDr() 28 | remDr \%>\% go("http://www.google.com/ncr") 29 | 30 | # get the title 31 | remDr \%>\% getTitle 32 | 33 | # get the current page url 34 | remDr \%>\% getCurrentUrl 35 | 36 | # navigate 37 | remDr \%>\% go("http://www.bbc.co.uk") 38 | 39 | # go back 40 | remDr \%>\% (seleniumPipes::back) 41 | 42 | # go forward 43 | remDr \%>\% forward 44 | 45 | # refresh page 46 | remDr \%>\% refresh 47 | 48 | # close browser 49 | remDr \%>\% deleteSession 50 | } 51 | 52 | } 53 | \seealso{ 54 | Other navigation functions: \code{\link{back}}, 55 | \code{\link{forward}}, \code{\link{getCurrentUrl}}, 56 | \code{\link{getTitle}}, \code{\link{go}} 57 | } 58 | 59 | -------------------------------------------------------------------------------- /man/releasingActions.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/interactions.R, R/interactionsDoc.R 3 | \name{releasingActions} 4 | \alias{releasingActions} 5 | \title{Not currently implemented} 6 | \usage{ 7 | releasingActions(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{releasingActions} The Release Actions command is used to cancel 24 | all current action chains. This is the equivalent of releasing all 25 | modifiers from input sources. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | # functions not currently implemented 30 | } 31 | 32 | } 33 | \seealso{ 34 | Other interactions functions: \code{\link{performActions}} 35 | } 36 | 37 | -------------------------------------------------------------------------------- /man/remoteDr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/init.R 3 | \name{remoteDr} 4 | \alias{remoteDr} 5 | \title{Create a remote driver} 6 | \usage{ 7 | remoteDr(remoteServerAddr = "http://localhost", port = 4444L, 8 | browserName = "firefox", version = "", platform = "ANY", 9 | javascript = TRUE, nativeEvents = TRUE, extraCapabilities = list(), 10 | path = "wd/hub", newSession = TRUE, ...) 11 | } 12 | \arguments{ 13 | \item{remoteServerAddr}{Object of class \code{"character"}, giving the 14 | ip of the remote server. Defaults to localhost} 15 | 16 | \item{port}{Object of class \code{"integer"}, the port of the remote 17 | server on which to connect} 18 | 19 | \item{browserName}{Object of class \code{"character"}. The name of the 20 | browser being used; choices include 21 | {chrome|firefox|internet explorer|iphone}. Defaults to firefox.} 22 | 23 | \item{version}{Object of class \code{"character"}. The browser version, 24 | or the empty string if unknown.} 25 | 26 | \item{platform}{Object of class \code{"character"}. A key specifying 27 | which platform the browser is running on. This value should be one 28 | of {WINDOWS|XP|VISTA|MAC|LINUX|UNIX}. When requesting a new session, 29 | the client may specify "ANY" to indicate any available platform may 30 | be used.} 31 | 32 | \item{javascript}{Object of class \code{"logical"}. Whether the session 33 | supports executing user supplied JavaScript in the context of the 34 | current page.} 35 | 36 | \item{nativeEvents}{Object of class \code{"logical"}. Whether the 37 | session supports native events. n WebDriver advanced user 38 | interactions are provided by either simulating the Javascript events 39 | directly (i.e. synthetic events) or by letting the browser generate 40 | the Javascript events (i.e. native events). Native events simulate 41 | the user interactions better.} 42 | 43 | \item{extraCapabilities}{A list containing any os/platform/driver 44 | specific arguments.} 45 | 46 | \item{path}{Path on the server side to issue webdriver calls to. 47 | Normally use the default value.} 48 | 49 | \item{newSession}{Logical value whether to start an instance of the 50 | browser. If TRUE a browser will be opened using 51 | \code{\link{newSession}}} 52 | 53 | \item{...}{Pass addional arguments to newSession. Currently used to 54 | pass \code{\link{retry}}} 55 | } 56 | \value{ 57 | An object of class "rDriver" is returned. This is a remote 58 | Driver object that is used in many of the remote driver specific 59 | functions. Many functions that take a remote driver object as input 60 | also return the remote driver object. This allows chaining of 61 | commands. See the examples for chaining in action. 62 | } 63 | \description{ 64 | \code{remoteDr}: Create a remote Driver object 65 | } 66 | \examples{ 67 | \dontrun{ 68 | # assume a server is available at the default location. 69 | remDr <- remoteDr() 70 | remDR \%>\% go("http://www.google.com") \%>\% 71 | findElement("name", "q") \%>\% 72 | elementSendKeys("R project", key = "enter") 73 | # close our browser 74 | remDr \%>\% deleteSession 75 | } 76 | 77 | } 78 | 79 | -------------------------------------------------------------------------------- /man/retry.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/zzz.R 3 | \name{retry} 4 | \alias{retry} 5 | \title{Documetation of retry argument} 6 | \description{ 7 | The ability to \code{retry} function code is enabled by default. 8 | \code{retry} can be a logical value. If it is TRUE then 9 | \code{noTry = getOption("seleniumPipes_no_try")} and 10 | \code{delay = getOption("seleniumPipes_no_try_delay")}. If it is 11 | FALSE the facility to have multiple trys of the function call is 12 | removed. \code{retry} can also be a list with the following named 13 | arguments that will override the values in \code{options} 14 | \describe{ 15 | \item{"noTry"}{Integer indicating how many times to try the 16 | function call} 17 | \item{"delay"}{Integer indicating delay between trys of the 18 | function call} 19 | } 20 | } 21 | \examples{ 22 | \dontrun{ 23 | remDr <- remoteDr() 24 | webElem <- remDr \%>\% go("http://www.google.com/ncr") \%>\% 25 | findElement("name", "q") 26 | # change the name of q with an 8 second delay 27 | myscript <- "var myElem = arguments[0]; 28 | window.setTimeout(function(){ 29 | myElem.setAttribute('name','funkyname'); 30 | }, 8000);" 31 | remDr \%>\% executeScript(myscript, args = list(webElem)) 32 | 33 | newWebElem <- remDr \%>\% findElement("name", "funkyname") 34 | 35 | # > newWebElem <- remDr \%>\% findElement("name", "funkyname") 36 | # 37 | # Calling findElement - Try no: 1 of 3 38 | # 39 | # Calling findElement - Try no: 2 of 3 40 | 41 | newWebElem \%>\% getElementAttribute("name") 42 | 43 | # compare with a function that will fail (no element present) 44 | rList <- list(noTry = 5, delay = 10) 45 | remDr \%>\% findElement("id", "i am not here", retry = rList) 46 | remDr \%>\% findElement("id", "i am not here", retry = FALSE) 47 | } 48 | } 49 | 50 | -------------------------------------------------------------------------------- /man/selKeys.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \docType{data} 4 | \name{selKeys} 5 | \alias{selKeys} 6 | \title{Selenium key mappings} 7 | \format{A named list. The names are the descriptions of the keys. The 8 | values are the "UTF-8" character representations.} 9 | \source{ 10 | http://code.google.com/p/selenium/wiki/JsonWireProtocol#/session/:sessionId/element/:id/value 11 | } 12 | \usage{ 13 | selKeys 14 | } 15 | \description{ 16 | This data set contains a list of selenium key mappings. 17 | The key mappings are outlined at \cr 18 | https://github.com/SeleniumHQ/selenium/wiki/JsonWireProtocol#sessionsessionidelementidvalue. 19 | selKeys is used when a sendKeys variable is needed. sendKeys is 20 | defined as a list. If an entry is needed from selKeys it is denoted 21 | by key. 22 | } 23 | \author{ 24 | John Harrison, 2012-10-05 25 | } 26 | \keyword{datasets} 27 | 28 | -------------------------------------------------------------------------------- /man/seleniumPipes.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/zzz.R 3 | \docType{package} 4 | \name{seleniumPipes} 5 | \alias{seleniumPipes} 6 | \alias{seleniumPipes-package} 7 | \title{Implements the W3C webdriver specification.} 8 | \description{ 9 | Implements the W3C webdriver specification. 10 | } 11 | \section{Package options}{ 12 | 13 | 14 | seleniumPipes uses the following \code{\link{options}} to configure 15 | behaviour: 16 | 17 | \itemize{ 18 | \item \code{seleniumPipes_display_screenshot}: Logical value 19 | indicating whether to display PNG returned by 20 | \code{\link{takeScreenshot}} and 21 | \code{\link{takeElementScreenshot}}. Defaults to TRUE 22 | 23 | \item \code{seleniumPipes_no_try}: An integer giving the number of 24 | time to try calling an endpoint 25 | on the Selenium Server. Defaults to 3 attempts 26 | 27 | \item \code{seleniumPipes_no_try_delay}: An integer detailing the 28 | delay between attempts to call a failing endpoint on the Selenium 29 | Server. Defaults to 5000 miliseconds = 5 seconds. 30 | 31 | \item \code{seleniumPipes_SL}: A logical value which acts as a flag 32 | indicating whether SauiceLabs is being used for package testing. 33 | 34 | \item \code{seleniumPipes_selOptions}: A list used to store options 35 | to pass to \code{\link{remoteDr}} when running tests. 36 | 37 | \item \code{seleniumPipes_sauceID}: A character used to store remote 38 | session ids when running SauceLab tests on the package. 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /man/sendAlertText.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/userPrompts.R, R/userPromptsDoc.R 3 | \name{sendAlertText} 4 | \alias{sendAlertText} 5 | \title{Send text to alert} 6 | \usage{ 7 | sendAlertText(remDr, text = "", ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{text}{A character vector of length 1. In other words a string. 14 | The text is passed to the JavaScript alert} 15 | 16 | \item{...}{Additonal function arguments - Currently passes the 17 | \code{\link{retry}} argument.} 18 | } 19 | \value{ 20 | invisible(remDr): An object of class "rDriver" is invisibly 21 | returned. A remote driver object see \code{\link{remoteDr}}. This 22 | allows for chaining from this function to other functions that take 23 | such an object as an argument. See examples for further details. 24 | } 25 | \description{ 26 | \code{sendAlertText} Send keystrokes to JavaScript prompt() dialog 27 | } 28 | \examples{ 29 | \dontrun{ 30 | remDr <- remoteDr() 31 | remDr \%>\% go("https://www.google.com/ncr") \%>\% 32 | getTitle() 33 | sScript <- "setTimeout(function(){alert('HELLO')},1000); return 'DONE';" 34 | remDr \%>\% executeScript(sScript, args = list()) 35 | remDr \%>\% dismissAlert() 36 | 37 | sScript <- "setTimeout(function(){confirm('Press a button')},1000); 38 | return 'DONE';" 39 | remDr \%>\% executeScript(sScript, args = list()) 40 | remDr \%>\% acceptAlert() 41 | 42 | sScript <- "setTimeout(function(){confirm('Press a button')},1000); 43 | return 'DONE';" 44 | remDr \%>\% executeScript(sScript, args = list()) 45 | remDr \%>\% getAlertText() 46 | remDr \%>\% dismissAlert() 47 | 48 | 49 | sScript <- 50 | "setTimeout(function(){prompt('Please enter your name', '')},1000); 51 | return 'DONE';" 52 | remDr \%>\% executeScript(sScript, args = list()) 53 | remDr \%>\% getAlertText() 54 | remDr \%>\% sendAlertText("Buck Rogers?") 55 | 56 | remDr \%>\% deleteSession() 57 | 58 | } 59 | } 60 | \seealso{ 61 | Other userPrompts functions: \code{\link{acceptAlert}}, 62 | \code{\link{dismissAlert}}, \code{\link{getAlertText}} 63 | } 64 | 65 | -------------------------------------------------------------------------------- /man/sendAlertTextOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{sendAlertTextOld} 4 | \alias{sendAlertTextOld} 5 | \title{Send text to alert} 6 | \usage{ 7 | sendAlertTextOld(remDr, text = "", ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{text}{A character vector of length 1. In other words a string. 14 | The text is passed to the JavaScript alert} 15 | 16 | \item{...}{Additonal function arguments - Currently passes the 17 | \code{\link{retry}} argument.} 18 | } 19 | \value{ 20 | invisible(remDr): An object of class "rDriver" is invisibly 21 | returned. A remote driver object see \code{\link{remoteDr}}. This 22 | allows for chaining from this function to other functions that take 23 | such an object as an argument. See examples for further details. 24 | } 25 | \description{ 26 | \code{sendAlertTextOld} Send keystrokes to JavaScript prompt() dialog. 27 | This uses the old JSONwireprotocol endpoints. 28 | } 29 | \examples{ 30 | \dontrun{ 31 | # functions in this group are using the old JSONwireprotocol end points 32 | } 33 | 34 | } 35 | \seealso{ 36 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 37 | \code{\link{dismissAlertOld}}, 38 | \code{\link{executeAsyncScriptOld}}, 39 | \code{\link{executeScriptOld}}, 40 | \code{\link{getAlertTextOld}}, 41 | \code{\link{getWindowHandleOld}}, 42 | \code{\link{getWindowHandlesOld}}, 43 | \code{\link{getWindowPositionOld}}, 44 | \code{\link{getWindowSizeOld}}, 45 | \code{\link{maximizeWindowOld}}, 46 | \code{\link{setWindowPositionOld}}, 47 | \code{\link{setWindowSizeOld}} 48 | } 49 | 50 | -------------------------------------------------------------------------------- /man/setTimeouts.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sessions.R, R/sessionsDoc.R 3 | \name{setTimeouts} 4 | \alias{setTimeouts} 5 | \title{Configure the amount of time that a particular type of operation can 6 | execute} 7 | \usage{ 8 | setTimeouts(remDr, type = "page load", milliseconds = 10000, ...) 9 | } 10 | \arguments{ 11 | \item{remDr}{An object of class "rDriver". A remote driver object see 12 | \code{\link{remoteDr}}.} 13 | 14 | \item{type}{The type of operation to set the timeout for. Valid values 15 | are: "script" for script timeouts, "implicit" for modifying the 16 | implicit wait timeout and "page load" for setting a page load 17 | timeout.} 18 | 19 | \item{milliseconds}{The amount of time, in milliseconds, that 20 | time-limited commands are permitted to run.} 21 | 22 | \item{...}{Additonal function arguments - Currently passes the 23 | \code{\link{retry}} argument.} 24 | } 25 | \value{ 26 | invisible(remDr): An object of class "rDriver" is invisibly 27 | returned. A remote driver object see \code{\link{remoteDr}}. This 28 | allows for chaining from this function to other functions that take 29 | such an object as an argument. See examples for further details. 30 | } 31 | \description{ 32 | \code{getTimeouts} Configure the amount of time that a particular type 33 | of operation can execute for before they are aborted and a |Timeout| 34 | error is returned to the client. 35 | } 36 | \examples{ 37 | \dontrun{ 38 | # start a driver without opening a browser 39 | remDr <- remoteDr(newSession = FALSE) 40 | 41 | # open a broswer 42 | remDr \%>\% newSession 43 | 44 | # set timeout on waiting for elements 45 | remDr \%>\% setTimeout(type = "implicit", 5000) 46 | 47 | # close Session 48 | remDr \%>\% deleteSession 49 | 50 | } 51 | 52 | } 53 | \seealso{ 54 | Other sessions functions: \code{\link{deleteSession}}, 55 | \code{\link{getTimeouts}}, \code{\link{newSession}}, 56 | \code{\link{status}} 57 | } 58 | 59 | -------------------------------------------------------------------------------- /man/setWindowPosition.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{setWindowPosition} 4 | \alias{setWindowPosition} 5 | \title{Change the position of the current window.} 6 | \usage{ 7 | setWindowPosition(remDr, x, y, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{x}{integer The X coordinate to position the window at, relative 14 | to the upper left corner of the screen.} 15 | 16 | \item{y}{integer The Y coordinate to position the window at, relative 17 | to the upper left corner of the screen.} 18 | 19 | \item{...}{Additonal function arguments - Currently passes the 20 | \code{\link{retry}} argument.} 21 | } 22 | \value{ 23 | invisible(remDr): An object of class "rDriver" is invisibly 24 | returned. A remote driver object see \code{\link{remoteDr}}. This 25 | allows for chaining from this function to other functions that take 26 | such an object as an argument. See examples for further details. 27 | } 28 | \description{ 29 | \code{setWindowPosition} Change the position of the current window. 30 | } 31 | \examples{ 32 | \dontrun{ 33 | remDr <- remoteDr() 34 | remDr \%>\% getWindowHandle() # The current window handle 35 | remDr \%>\% getWindowHandles() # All windows in the session 36 | 37 | # Get the window position 38 | remDr \%>\% getWindowPosition 39 | 40 | # Some browsers are still using the old JSON wire end points 41 | remDr \%>\% getWindowPositionOld 42 | 43 | # Get the size of the window 44 | remDr \%>\% getWindowSize 45 | 46 | # Some browsers are still using the old JSON wire end points 47 | # remDr \%>\% getWindowSizeOld 48 | 49 | # Set the window size 50 | remDr \%>\% setWindowSize(500, 500) 51 | 52 | # Some browsers are still using the old JSON wire end points 53 | remDr \%>\% setWindowSizeOld(500, 500) 54 | 55 | # Set the position of the window 56 | remDr \%>\% setWindowPositionOld(400, 100) 57 | 58 | # Some browsers are still using the old JSON wire end points 59 | # remDr \%>\% setWindowPositionOld(400, 100) 60 | 61 | # Maximise the window 62 | remDr \%>\% maximizeWindow 63 | # Some browsers are still using the old JSON wire end points 64 | # remDr \%>\% maximizeWindowold() 65 | 66 | remDr \%>\% go("http://www.google.com/ncr") 67 | # search for the "R project" 68 | 69 | remDr \%>\% findElement("name", "q") \%>\% 70 | elementSendKeys("R project", key = "enter") 71 | 72 | webElem <- remDr \%>\% findElement("css", "h3.r a") 73 | 74 | remDr \%>\% deleteSession 75 | } 76 | } 77 | \seealso{ 78 | Other commandContexts functions: \code{\link{closeWindow}}, 79 | \code{\link{fullscreenWindow}}, 80 | \code{\link{getWindowHandles}}, 81 | \code{\link{getWindowHandle}}, 82 | \code{\link{getWindowPosition}}, 83 | \code{\link{getWindowSize}}, 84 | \code{\link{maximizeWindow}}, 85 | \code{\link{setWindowSize}}, \code{\link{switchToFrame}}, 86 | \code{\link{switchToParentFrame}}, 87 | \code{\link{switchToWindow}} 88 | } 89 | 90 | -------------------------------------------------------------------------------- /man/setWindowPositionOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{setWindowPositionOld} 4 | \alias{setWindowPositionOld} 5 | \title{Change the position of the specified window.} 6 | \usage{ 7 | setWindowPositionOld(remDr, x, y, handle = "current", ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{x}{integer The X coordinate to position the window at, relative 14 | to the upper left corner of the screen.} 15 | 16 | \item{y}{integer The Y coordinate to position the window at, relative 17 | to the upper left corner of the screen.} 18 | 19 | \item{handle}{Handle of the window to query. If handle = "current" 20 | (the default) the current window is used.} 21 | 22 | \item{...}{Additonal function arguments - Currently passes the 23 | \code{\link{retry}} argument.} 24 | } 25 | \value{ 26 | invisible(remDr): An object of class "rDriver" is invisibly 27 | returned. A remote driver object see \code{\link{remoteDr}}. This 28 | allows for chaining from this function to other functions that take 29 | such an object as an argument. See examples for further details. 30 | } 31 | \description{ 32 | \code{setWindowSize} Change the position of the specified window. 33 | } 34 | \examples{ 35 | \dontrun{ 36 | # functions in this group are using the old JSONwireprotocol end points 37 | } 38 | 39 | } 40 | \seealso{ 41 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 42 | \code{\link{dismissAlertOld}}, 43 | \code{\link{executeAsyncScriptOld}}, 44 | \code{\link{executeScriptOld}}, 45 | \code{\link{getAlertTextOld}}, 46 | \code{\link{getWindowHandleOld}}, 47 | \code{\link{getWindowHandlesOld}}, 48 | \code{\link{getWindowPositionOld}}, 49 | \code{\link{getWindowSizeOld}}, 50 | \code{\link{maximizeWindowOld}}, 51 | \code{\link{sendAlertTextOld}}, 52 | \code{\link{setWindowSizeOld}} 53 | } 54 | 55 | -------------------------------------------------------------------------------- /man/setWindowSize.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{setWindowSize} 4 | \alias{setWindowSize} 5 | \title{Change the size of the current window.} 6 | \usage{ 7 | setWindowSize(remDr, width, height, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{width}{integer The new window width.} 14 | 15 | \item{height}{integer The new window height.} 16 | 17 | \item{...}{Additonal function arguments - Currently passes the 18 | \code{\link{retry}} argument.} 19 | } 20 | \value{ 21 | invisible(remDr): An object of class "rDriver" is invisibly 22 | returned. A remote driver object see \code{\link{remoteDr}}. This 23 | allows for chaining from this function to other functions that take 24 | such an object as an argument. See examples for further details. 25 | } 26 | \description{ 27 | \code{setWindowSize} Change the size of the current window. 28 | } 29 | \examples{ 30 | \dontrun{ 31 | remDr <- remoteDr() 32 | remDr \%>\% getWindowHandle() # The current window handle 33 | remDr \%>\% getWindowHandles() # All windows in the session 34 | 35 | # Get the window position 36 | remDr \%>\% getWindowPosition 37 | 38 | # Some browsers are still using the old JSON wire end points 39 | remDr \%>\% getWindowPositionOld 40 | 41 | # Get the size of the window 42 | remDr \%>\% getWindowSize 43 | 44 | # Some browsers are still using the old JSON wire end points 45 | # remDr \%>\% getWindowSizeOld 46 | 47 | # Set the window size 48 | remDr \%>\% setWindowSize(500, 500) 49 | 50 | # Some browsers are still using the old JSON wire end points 51 | remDr \%>\% setWindowSizeOld(500, 500) 52 | 53 | # Set the position of the window 54 | remDr \%>\% setWindowPositionOld(400, 100) 55 | 56 | # Some browsers are still using the old JSON wire end points 57 | # remDr \%>\% setWindowPositionOld(400, 100) 58 | 59 | # Maximise the window 60 | remDr \%>\% maximizeWindow 61 | # Some browsers are still using the old JSON wire end points 62 | # remDr \%>\% maximizeWindowold() 63 | 64 | remDr \%>\% go("http://www.google.com/ncr") 65 | # search for the "R project" 66 | 67 | remDr \%>\% findElement("name", "q") \%>\% 68 | elementSendKeys("R project", key = "enter") 69 | 70 | webElem <- remDr \%>\% findElement("css", "h3.r a") 71 | 72 | remDr \%>\% deleteSession 73 | } 74 | } 75 | \seealso{ 76 | Other commandContexts functions: \code{\link{closeWindow}}, 77 | \code{\link{fullscreenWindow}}, 78 | \code{\link{getWindowHandles}}, 79 | \code{\link{getWindowHandle}}, 80 | \code{\link{getWindowPosition}}, 81 | \code{\link{getWindowSize}}, 82 | \code{\link{maximizeWindow}}, 83 | \code{\link{setWindowPosition}}, 84 | \code{\link{switchToFrame}}, 85 | \code{\link{switchToParentFrame}}, 86 | \code{\link{switchToWindow}} 87 | } 88 | 89 | -------------------------------------------------------------------------------- /man/setWindowSizeOld.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/oldMethods.R, R/oldMethodsDoc.R 3 | \name{setWindowSizeOld} 4 | \alias{setWindowSizeOld} 5 | \title{Change the size of the specified window.} 6 | \usage{ 7 | setWindowSizeOld(remDr, width, height, handle = "current", ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{width}{integer The new window width.} 14 | 15 | \item{height}{integer The new window height.} 16 | 17 | \item{handle}{Handle of the window to query. If handle = "current" 18 | (the default) the current window is used.} 19 | 20 | \item{...}{Additonal function arguments - Currently passes the 21 | \code{\link{retry}} argument.} 22 | } 23 | \value{ 24 | invisible(remDr): An object of class "rDriver" is invisibly 25 | returned. A remote driver object see \code{\link{remoteDr}}. This 26 | allows for chaining from this function to other functions that take 27 | such an object as an argument. See examples for further details. 28 | } 29 | \description{ 30 | \code{setWindowSize} Change the size of the specified window. 31 | } 32 | \examples{ 33 | \dontrun{ 34 | # functions in this group are using the old JSONwireprotocol end points 35 | } 36 | 37 | } 38 | \seealso{ 39 | Other oldMethods functions: \code{\link{acceptAlertOld}}, 40 | \code{\link{dismissAlertOld}}, 41 | \code{\link{executeAsyncScriptOld}}, 42 | \code{\link{executeScriptOld}}, 43 | \code{\link{getAlertTextOld}}, 44 | \code{\link{getWindowHandleOld}}, 45 | \code{\link{getWindowHandlesOld}}, 46 | \code{\link{getWindowPositionOld}}, 47 | \code{\link{getWindowSizeOld}}, 48 | \code{\link{maximizeWindowOld}}, 49 | \code{\link{sendAlertTextOld}}, 50 | \code{\link{setWindowPositionOld}} 51 | } 52 | 53 | -------------------------------------------------------------------------------- /man/status.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/sessions.R, R/sessionsDoc.R 3 | \name{status} 4 | \alias{status} 5 | \title{Get remote end status.} 6 | \usage{ 7 | status(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | ret2 : res$value NEED TO FILL IN specifics for each function 18 | } 19 | \description{ 20 | \code{status} The Status command returns information about whether a 21 | remote end is in a state in which it can create a new session. 22 | This is represented by the ready property of the response body, 23 | which has a value of false if attempting to create a session at 24 | the current time would fail. 25 | } 26 | \examples{ 27 | \dontrun{ 28 | # start a driver without opening a browser 29 | remDr <- remoteDr(newSession = FALSE) 30 | 31 | # open a broswer 32 | remDr \%>\% newSession 33 | 34 | # set timeout on waiting for elements 35 | remDr \%>\% setTimeout(type = "implicit", 5000) 36 | 37 | # close Session 38 | remDr \%>\% deleteSession 39 | 40 | } 41 | 42 | } 43 | \seealso{ 44 | Other sessions functions: \code{\link{deleteSession}}, 45 | \code{\link{getTimeouts}}, \code{\link{newSession}}, 46 | \code{\link{setTimeouts}} 47 | } 48 | 49 | -------------------------------------------------------------------------------- /man/switchToFrame.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{switchToFrame} 4 | \alias{switchToFrame} 5 | \title{Change focus to another frame on the page.} 6 | \usage{ 7 | switchToFrame(remDr, Id = NULL, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{Id}{{string|number|null|WebElement} Identifier for the frame to 14 | change focus to.} 15 | 16 | \item{...}{Additonal function arguments - Currently passes the 17 | \code{\link{retry}} argument.} 18 | } 19 | \value{ 20 | invisible(remDr): An object of class "rDriver" is invisibly 21 | returned. A remote driver object see \code{\link{remoteDr}}. This 22 | allows for chaining from this function to other functions that take 23 | such an object as an argument. See examples for further details. 24 | } 25 | \description{ 26 | \code{switchToFrame} Change focus to another frame on the page. If the 27 | frame id is null, the server should switch to the page's default 28 | content. 29 | } 30 | \examples{ 31 | \dontrun{ 32 | remDr <- remoteDr() 33 | remDr \%>\% getWindowHandle() # The current window handle 34 | remDr \%>\% getWindowHandles() # All windows in the session 35 | 36 | # Get the window position 37 | remDr \%>\% getWindowPosition 38 | 39 | # Some browsers are still using the old JSON wire end points 40 | remDr \%>\% getWindowPositionOld 41 | 42 | # Get the size of the window 43 | remDr \%>\% getWindowSize 44 | 45 | # Some browsers are still using the old JSON wire end points 46 | # remDr \%>\% getWindowSizeOld 47 | 48 | # Set the window size 49 | remDr \%>\% setWindowSize(500, 500) 50 | 51 | # Some browsers are still using the old JSON wire end points 52 | remDr \%>\% setWindowSizeOld(500, 500) 53 | 54 | # Set the position of the window 55 | remDr \%>\% setWindowPositionOld(400, 100) 56 | 57 | # Some browsers are still using the old JSON wire end points 58 | # remDr \%>\% setWindowPositionOld(400, 100) 59 | 60 | # Maximise the window 61 | remDr \%>\% maximizeWindow 62 | # Some browsers are still using the old JSON wire end points 63 | # remDr \%>\% maximizeWindowold() 64 | 65 | remDr \%>\% go("http://www.google.com/ncr") 66 | # search for the "R project" 67 | 68 | remDr \%>\% findElement("name", "q") \%>\% 69 | elementSendKeys("R project", key = "enter") 70 | 71 | webElem <- remDr \%>\% findElement("css", "h3.r a") 72 | 73 | remDr \%>\% deleteSession 74 | } 75 | } 76 | \seealso{ 77 | Other commandContexts functions: \code{\link{closeWindow}}, 78 | \code{\link{fullscreenWindow}}, 79 | \code{\link{getWindowHandles}}, 80 | \code{\link{getWindowHandle}}, 81 | \code{\link{getWindowPosition}}, 82 | \code{\link{getWindowSize}}, 83 | \code{\link{maximizeWindow}}, 84 | \code{\link{setWindowPosition}}, 85 | \code{\link{setWindowSize}}, 86 | \code{\link{switchToParentFrame}}, 87 | \code{\link{switchToWindow}} 88 | } 89 | 90 | -------------------------------------------------------------------------------- /man/switchToParentFrame.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{switchToParentFrame} 4 | \alias{switchToParentFrame} 5 | \title{Change focus to the parent context.} 6 | \usage{ 7 | switchToParentFrame(remDr, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{...}{Additonal function arguments - Currently passes the 14 | \code{\link{retry}} argument.} 15 | } 16 | \value{ 17 | invisible(remDr): An object of class "rDriver" is invisibly 18 | returned. A remote driver object see \code{\link{remoteDr}}. This 19 | allows for chaining from this function to other functions that take 20 | such an object as an argument. See examples for further details. 21 | } 22 | \description{ 23 | \code{switchToParentFrame} Change focus to the parent context. If the 24 | current context is the top level browsing context, the context 25 | remains unchanged. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | remDr <- remoteDr() 30 | remDr \%>\% getWindowHandle() # The current window handle 31 | remDr \%>\% getWindowHandles() # All windows in the session 32 | 33 | # Get the window position 34 | remDr \%>\% getWindowPosition 35 | 36 | # Some browsers are still using the old JSON wire end points 37 | remDr \%>\% getWindowPositionOld 38 | 39 | # Get the size of the window 40 | remDr \%>\% getWindowSize 41 | 42 | # Some browsers are still using the old JSON wire end points 43 | # remDr \%>\% getWindowSizeOld 44 | 45 | # Set the window size 46 | remDr \%>\% setWindowSize(500, 500) 47 | 48 | # Some browsers are still using the old JSON wire end points 49 | remDr \%>\% setWindowSizeOld(500, 500) 50 | 51 | # Set the position of the window 52 | remDr \%>\% setWindowPositionOld(400, 100) 53 | 54 | # Some browsers are still using the old JSON wire end points 55 | # remDr \%>\% setWindowPositionOld(400, 100) 56 | 57 | # Maximise the window 58 | remDr \%>\% maximizeWindow 59 | # Some browsers are still using the old JSON wire end points 60 | # remDr \%>\% maximizeWindowold() 61 | 62 | remDr \%>\% go("http://www.google.com/ncr") 63 | # search for the "R project" 64 | 65 | remDr \%>\% findElement("name", "q") \%>\% 66 | elementSendKeys("R project", key = "enter") 67 | 68 | webElem <- remDr \%>\% findElement("css", "h3.r a") 69 | 70 | remDr \%>\% deleteSession 71 | } 72 | } 73 | \seealso{ 74 | Other commandContexts functions: \code{\link{closeWindow}}, 75 | \code{\link{fullscreenWindow}}, 76 | \code{\link{getWindowHandles}}, 77 | \code{\link{getWindowHandle}}, 78 | \code{\link{getWindowPosition}}, 79 | \code{\link{getWindowSize}}, 80 | \code{\link{maximizeWindow}}, 81 | \code{\link{setWindowPosition}}, 82 | \code{\link{setWindowSize}}, \code{\link{switchToFrame}}, 83 | \code{\link{switchToWindow}} 84 | } 85 | 86 | -------------------------------------------------------------------------------- /man/switchToWindow.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/commandContexts.R, R/commandContextsDoc.R 3 | \name{switchToWindow} 4 | \alias{switchToWindow} 5 | \title{Change focus to another window.} 6 | \usage{ 7 | switchToWindow(remDr, name, ...) 8 | } 9 | \arguments{ 10 | \item{remDr}{An object of class "rDriver". A remote driver object see 11 | \code{\link{remoteDr}}.} 12 | 13 | \item{name}{The handle of the window to change focus to.} 14 | 15 | \item{...}{Additonal function arguments - Currently passes the 16 | \code{\link{retry}} argument.} 17 | } 18 | \value{ 19 | invisible(remDr): An object of class "rDriver" is invisibly 20 | returned. A remote driver object see \code{\link{remoteDr}}. This 21 | allows for chaining from this function to other functions that take 22 | such an object as an argument. See examples for further details. 23 | } 24 | \description{ 25 | \code{switchToWindow} Change focus to another window. 26 | } 27 | \examples{ 28 | \dontrun{ 29 | remDr <- remoteDr() 30 | remDr \%>\% getWindowHandle() # The current window handle 31 | remDr \%>\% getWindowHandles() # All windows in the session 32 | 33 | # Get the window position 34 | remDr \%>\% getWindowPosition 35 | 36 | # Some browsers are still using the old JSON wire end points 37 | remDr \%>\% getWindowPositionOld 38 | 39 | # Get the size of the window 40 | remDr \%>\% getWindowSize 41 | 42 | # Some browsers are still using the old JSON wire end points 43 | # remDr \%>\% getWindowSizeOld 44 | 45 | # Set the window size 46 | remDr \%>\% setWindowSize(500, 500) 47 | 48 | # Some browsers are still using the old JSON wire end points 49 | remDr \%>\% setWindowSizeOld(500, 500) 50 | 51 | # Set the position of the window 52 | remDr \%>\% setWindowPositionOld(400, 100) 53 | 54 | # Some browsers are still using the old JSON wire end points 55 | # remDr \%>\% setWindowPositionOld(400, 100) 56 | 57 | # Maximise the window 58 | remDr \%>\% maximizeWindow 59 | # Some browsers are still using the old JSON wire end points 60 | # remDr \%>\% maximizeWindowold() 61 | 62 | remDr \%>\% go("http://www.google.com/ncr") 63 | # search for the "R project" 64 | 65 | remDr \%>\% findElement("name", "q") \%>\% 66 | elementSendKeys("R project", key = "enter") 67 | 68 | webElem <- remDr \%>\% findElement("css", "h3.r a") 69 | 70 | remDr \%>\% deleteSession 71 | } 72 | } 73 | \seealso{ 74 | Other commandContexts functions: \code{\link{closeWindow}}, 75 | \code{\link{fullscreenWindow}}, 76 | \code{\link{getWindowHandles}}, 77 | \code{\link{getWindowHandle}}, 78 | \code{\link{getWindowPosition}}, 79 | \code{\link{getWindowSize}}, 80 | \code{\link{maximizeWindow}}, 81 | \code{\link{setWindowPosition}}, 82 | \code{\link{setWindowSize}}, \code{\link{switchToFrame}}, 83 | \code{\link{switchToParentFrame}} 84 | } 85 | 86 | -------------------------------------------------------------------------------- /man/takeElementScreenshot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/screenCapture.R, R/screenCaptureDoc.R 3 | \name{takeElementScreenshot} 4 | \alias{takeElementScreenshot} 5 | \title{takeElementScreenshot} 6 | \usage{ 7 | takeElementScreenshot(webElem, file = NULL, 8 | display = getOption("seleniumPipes_display_screenshot"), 9 | useViewer = !is.null(getOption("viewer")), returnPNG = FALSE, ...) 10 | } 11 | \arguments{ 12 | \item{webElem}{An object of class "wElement". A web Element object see 13 | \code{\link{wbElement}}.} 14 | 15 | \item{file}{If not null the decoded PNG is written to file using the 16 | string provided here. Defaults to NULL.} 17 | 18 | \item{display}{logical Display the PNG or not (default is set in 19 | getOption("seleniumPipes_display_screenshot")).} 20 | 21 | \item{useViewer}{A viewer to view the PNG. Looks for the RSudio viewer 22 | by default.} 23 | 24 | \item{returnPNG}{logical return the decoded PNG. If false (default) 25 | webElem is returned to allow chaining.} 26 | 27 | \item{...}{Additonal function arguments - Currently passes the 28 | \code{\link{retry}} argument.} 29 | } 30 | \value{ 31 | If \code{returnPNG} is FALSE the web Element object is returned 32 | and additonal chaining is possible. If TRUE then the decoded base64 33 | image is returned see \code{\link{base64_dec}} 34 | } 35 | \description{ 36 | \code{takeElementScreenshot} 37 | } 38 | \examples{ 39 | \dontrun{ 40 | remDr <- remoteDr() 41 | remDr \%>\% go("http://www.google.com/ncr") 42 | remDr \%>\% takeScreenshot 43 | 44 | # select the search box 45 | searchElem <- remDr \%>\% findElement("name", "q") 46 | #searchElem \%>\% takeElementScreenshot() 47 | } 48 | 49 | } 50 | \seealso{ 51 | Other screenCapture functions: \code{\link{takeScreenshot}} 52 | } 53 | 54 | -------------------------------------------------------------------------------- /man/takeScreenshot.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/screenCapture.R, R/screenCaptureDoc.R 3 | \name{takeScreenshot} 4 | \alias{takeScreenshot} 5 | \title{takeScreenshot} 6 | \usage{ 7 | takeScreenshot(remDr, file = NULL, 8 | display = getOption("seleniumPipes_display_screenshot"), 9 | useViewer = !is.null(getOption("viewer")), returnPNG = FALSE, ...) 10 | } 11 | \arguments{ 12 | \item{remDr}{An object of class "rDriver". A remote driver object see 13 | \code{\link{remoteDr}}.} 14 | 15 | \item{file}{If not null the decoded PNG is written to file using the 16 | string provided here. Defaults to NULL.} 17 | 18 | \item{display}{logical Display the PNG or not (default is set in 19 | getOption("seleniumPipes_display_screenshot")).} 20 | 21 | \item{useViewer}{A viewer to view the PNG. Looks for the RSudio viewer 22 | by default.} 23 | 24 | \item{returnPNG}{logical return the decoded PNG. If false (default) 25 | remDr is returned to allow chaining.} 26 | 27 | \item{...}{Additonal function arguments - Currently passes the 28 | \code{\link{retry}} argument.} 29 | } 30 | \value{ 31 | If \code{returnPNG} is FALSE the remote Driver object is 32 | returned and additonal chaining is possible. If TRUE then the 33 | decoded base64 image is returned see \code{\link{base64_dec}} 34 | } 35 | \description{ 36 | \code{takeScreenshot} 37 | } 38 | \examples{ 39 | \dontrun{ 40 | remDr <- remoteDr() 41 | remDr \%>\% go("http://www.google.com/ncr") 42 | remDr \%>\% takeScreenshot 43 | 44 | # select the search box 45 | searchElem <- remDr \%>\% findElement("name", "q") 46 | #searchElem \%>\% takeElementScreenshot() 47 | } 48 | 49 | } 50 | \seealso{ 51 | Other screenCapture functions: \code{\link{takeElementScreenshot}} 52 | } 53 | 54 | -------------------------------------------------------------------------------- /man/wbElement.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/init.R 3 | \name{wbElement} 4 | \alias{wbElement} 5 | \title{Create a Web Element} 6 | \usage{ 7 | wbElement(elementId, remDr) 8 | } 9 | \arguments{ 10 | \item{elementId}{This is a string returned by the web driver that 11 | identifies the web element.} 12 | 13 | \item{remDr}{An object of class "rDriver". A remote driver object see 14 | \code{\link{remoteDr}}.} 15 | } 16 | \value{ 17 | An object of class "wElement" is returned. This is a web 18 | element object that is used in many of the web Element specific 19 | functions. Many functions that take a web Element object as input 20 | also return the web Element object. This allows chaining of 21 | commands. See the examples for chaining in action. 22 | } 23 | \description{ 24 | \code{wbElement} Create a Web Element object of class "wElement" 25 | } 26 | \examples{ 27 | \dontrun{ 28 | remDr <- remoteDr() 29 | webElem <- remDR \%>\% go("http://www.google.com") \%>\% 30 | findElement("name", "q") 31 | # print the webElement 32 | webElem 33 | 34 | # send keys to the web Element 35 | webElem \%>\% elementSendKeys("R project", key = "enter") 36 | 37 | # close browser 38 | remDr \%>\% deleteSession() 39 | } 40 | } 41 | 42 | -------------------------------------------------------------------------------- /tests/README.md: -------------------------------------------------------------------------------- 1 | ### Tests for seleniumPipes 2 | 3 | These tests are converted from the Python tests in the Selenium project. 4 | The tests use a set of HTML documents that can be sourced using 5 | 6 | ``` 7 | svn checkout https://github.com/SeleniumHQ/selenium/trunk/common/src/web 8 | ``` 9 | 10 | The tests assume these HTML documents are available and served locally. To 11 | serve the files we use a Docker image [redsadic/docker-http-server](https://hub.docker.com/r/redsadic/docker-http-server/). 12 | This image runs the node application http-server exposing the 13 | /public directory at port 8080. We map the public directory on the 14 | container to the web directory above on the Host (We assume the docker 15 | commands are issued from the parent folder containing the web directory 16 | - a legacy of using the same calls on TRAVIS): 17 | 18 | ``` 19 | docker run -d -p 3000:8080 --name http-server -v $(pwd)/web:/public redsadic/docker-http-server& 20 | ``` 21 | 22 | Next we run a Docker image containing the standalone Selenium server and a 23 | chrome browser: 24 | 25 | ``` 26 | docker run -d -p 127.0.0.1:4444:4444 --link http-server selenium/standalone-chrome:2.53.1 27 | 28 | ``` 29 | 30 | or a debug version with VNC exposed on port 5901 of the host 31 | 32 | ``` 33 | docker run -d -p 5901:5900 -p 127.0.0.1:4444:4444 --link http-server selenium/standalone-chrome-debug:2.53.1 34 | 35 | ``` 36 | The two Docker containers are linked so the Selenium server will be able 37 | to access the http server on its port 8080 and referencing the http server 38 | as "http-server" 39 | 40 | ``` 41 | http-server:8080/*.html 42 | ``` 43 | 44 | Normally on the test machine docker containers are stopped and removed 45 | prior to testing: 46 | 47 | ``` 48 | docker stop $(docker ps -q) 49 | docker rm $(docker ps -aq) 50 | ``` 51 | #### System variables 52 | 53 | For CRAN and TRAVIS compatibility two env variables are looked for: 54 | NOT_CRAN and TRAVIS. If the tests are being ran locally with the above 55 | setup you can set these environmental variables = "true" or set them in 56 | R: 57 | 58 | ``` 59 | Sys.setenv("NOT_CRAN" = "true") 60 | Sys.setenv("TRAVIS" = "true") 61 | ``` 62 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(seleniumPipes) 3 | library(xml2) 4 | if(Sys.getenv("NOT_CRAN") == "true"){ 5 | test_check("seleniumPipes") 6 | } 7 | -------------------------------------------------------------------------------- /tests/testthat/helper.R: -------------------------------------------------------------------------------- 1 | initFun <- function(){ 2 | if(identical(TRUE, getOption("seleniumPipes_SL"))){ 3 | # sauce labs test 4 | pv <- packageVersion("seleniumPipes") 5 | slFlags <- list( 6 | name = "seleniumPipes-test-suite", 7 | build = sum(unlist(pv)*10^(3-seq_along(unlist(pv)))) 8 | , tags = list("api-example"), 9 | "custom-data" = list( 10 | release = do.call(paste, list(pv, collapse = ".")) 11 | ) 12 | ) 13 | selOptions <- getOption("seleniumPipes_selOptions") 14 | selOptions$extraCapabilities <- c(selOptions$extraCapabilities, 15 | slFlags) 16 | options(seleniumPipes_selOptions = selOptions) 17 | source(file.path("tests", "testthat", 'setup.R'), local = TRUE) 18 | }else{ 19 | remDr <- remoteDr(browserName = "chrome") 20 | # set page load timeout to 3 secs 21 | remDr %>% setTimeouts(milliseconds = 10000) 22 | # wait 5 secs for elements to load 23 | remDr %>% setTimeouts(type = "implicit", milliseconds = 5000) 24 | htmlSrc <- if(identical(Sys.getenv("TRAVIS"), "true")){ 25 | "http-server:8080" 26 | }else{ 27 | "localhost:3000" 28 | } 29 | loadPage <- function(pgStr){ 30 | paste0("http://", file.path(htmlSrc, paste0(pgStr, ".html"))) 31 | } 32 | rdBrowser <- remDr$sessionInfo$browserName 33 | 34 | } 35 | list(remDr = remDr, rdBrowser = rdBrowser, loadPage = loadPage) 36 | } 37 | -------------------------------------------------------------------------------- /tests/testthat/setup.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | if(is.null(getOption("seleniumPipes_selOptions"))){ 3 | stop("Please set test options") 4 | } 5 | remDr <- do.call(remoteDr, getOption("seleniumPipes_selOptions")) 6 | if(identical(getOption("seleniumPipes_SL"), TRUE)){ 7 | options(seleniumPipes_sauceID = 8 | remDr$sessionInfo$webdriver.remote.sessionid) 9 | } 10 | # set page load timeout to 3 secs 11 | remDr %>% setTimeouts(milliseconds = 10000) 12 | # wait 5 secs for elements to load 13 | remDr %>% setTimeouts(type = "implicit", milliseconds = 5000) 14 | rdBrowser <- remDr$sessionInfo$browserName 15 | if(rdBrowser %in% c("iPhone", "iPad", "safari")){ 16 | htmlSrc <- "myname.local:3000" 17 | }else{ 18 | # add somethin like 127.0.0.1 myname.local to /etc/hosts or equivalent 19 | htmlSrc <- "localhost:3000" 20 | } 21 | loadPage <- function(pgStr){ 22 | paste0("http://", file.path(htmlSrc, paste0(pgStr, ".html"))) 23 | } 24 | -------------------------------------------------------------------------------- /tests/testthat/test-page_loading_tests.R: -------------------------------------------------------------------------------- 1 | context("page_loading_tests") 2 | init <- initFun() 3 | remDr <- init$remDr; rdBrowser <- init$rdBrowser; loadPage <- init$loadPage 4 | on.exit(remDr %>% deleteSession()) 5 | 6 | test_that("testShouldWaitForDocumentToBeLoaded", { 7 | skip_on_cran() 8 | result <- remDr %>% go(loadPage("simpleTest")) %>% 9 | getTitle 10 | expect_identical(result, "Hello WebDriver") 11 | } 12 | ) 13 | 14 | test_that("testShouldBeAbleToGetAFragmentOnTheCurrentPage", { 15 | skip_on_cran() 16 | result <- remDr %>% go(loadPage("xhtmlTest")) %>% 17 | getCurrentUrl 18 | wElem <- remDr %>% go(paste0(result, "#text")) %>% 19 | findElement("id", "id1") 20 | expect_true(inherits(wElem, "wElement")) 21 | } 22 | ) 23 | 24 | test_that("testShouldReturnWhenGettingAUrlThatDoesNotResolve", { 25 | skip_on_cran() 26 | expect_silent( 27 | result <- remDr %>% go("http://www.thisurldoesnotexist.comx/") 28 | ) 29 | } 30 | ) 31 | 32 | test_that("testShouldReturnWhenGettingAUrlThatDoesNotConnect", { 33 | skip_on_cran() 34 | expect_silent( 35 | result <- remDr %>% go("http://localhost:3001") 36 | ) 37 | } 38 | ) 39 | 40 | test_that("testShouldBeAbleToNavigateBackInTheBrowserHistory", { 41 | remDr %>% go(loadPage("formPage")) %>% 42 | findElement("id", "imageButton") %>% 43 | elementClick 44 | result <- remDr %>% getTitle 45 | expect_identical(result, "We Arrive Here") 46 | resBack <- remDr %>% back %>% 47 | getTitle 48 | expect_identical(resBack, "We Leave From Here") 49 | } 50 | ) 51 | 52 | test_that("testShouldBeAbleToNavigateBackInPresenceOfIframes", { 53 | skip_on_cran() 54 | remDr %>% go(loadPage("xhtmlTest")) %>% 55 | findElement("name", "sameWindow") %>% 56 | elementClick 57 | expect_identical(remDr %>% getTitle, "This page has iframes") 58 | result <- remDr %>% back %>% 59 | getTitle 60 | expect_identical(result, "XHTML Test Page") 61 | } 62 | ) 63 | 64 | test_that("testShouldBeAbleToNavigateForwardsInTheBrowserHistory", { 65 | skip_on_cran() 66 | remDr %>% go(loadPage("formPage")) %>% 67 | findElement("id", "imageButton") %>% 68 | elementClick 69 | expect_identical(remDr %>% getTitle, "We Arrive Here") 70 | remDr %>% back 71 | expect_identical(remDr %>% getTitle, "We Leave From Here") 72 | remDr %>% forward 73 | expect_identical(remDr %>% getTitle, "We Arrive Here") 74 | } 75 | ) 76 | 77 | test_that("testShouldNotHangifOpenCallIsNeverFollowedByCloseCall", { 78 | skip_on_cran() 79 | result <- remDr %>% go(loadPage("document_write_in_onload")) %>% 80 | findElement("xpath", "//body") 81 | expect_true(inherits(result, "wElement")) 82 | } 83 | ) 84 | 85 | test_that("testShouldBeAbleToRefreshAPage", { 86 | result <- remDr %>% go(loadPage("xhtmlTest")) %>% 87 | refresh %>% 88 | getTitle 89 | expect_identical(result, "XHTML Test Page") 90 | } 91 | ) 92 | -------------------------------------------------------------------------------- /tests/testthat/test-takes_screenshots_tests.R: -------------------------------------------------------------------------------- 1 | context("takes_screenshots_tests") 2 | init <- initFun() 3 | remDr <- init$remDr; rdBrowser <- init$rdBrowser; loadPage <- init$loadPage 4 | on.exit(remDr %>% deleteSession()) 5 | 6 | test_that("testShouldWriteScreenshotToFile", { 7 | skip_on_cran() 8 | tmpF <- tempfile() 9 | result <- remDr %>% go(loadPage("simpleTest")) %>% 10 | takeScreenshot(file = tmpF) 11 | expect_true(file.exists(tmpF)) 12 | } 13 | ) 14 | 15 | test_that("test_get_screenshot_as_png", { 16 | skip_on_cran() 17 | if (!.Platform$OS.type == "unix") { 18 | skip("unix file command used to determine file type") 19 | } 20 | tmpF <- tempfile() 21 | result <- remDr %>% go(loadPage("simpleTest")) %>% 22 | takeScreenshot(file = tmpF) 23 | fileInfo <- system(paste("file --mime-type", tmpF), intern = TRUE) 24 | expect_true(grepl("image/png", fileInfo)) 25 | } 26 | ) 27 | -------------------------------------------------------------------------------- /vignettes/chromeBrowser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johndharrison/seleniumPipes/53a268dc1496af84278019213f8e556df041034a/vignettes/chromeBrowser.png -------------------------------------------------------------------------------- /vignettes/cranFrameColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johndharrison/seleniumPipes/53a268dc1496af84278019213f8e556df041034a/vignettes/cranFrameColor.png -------------------------------------------------------------------------------- /vignettes/googleAndCran.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johndharrison/seleniumPipes/53a268dc1496af84278019213f8e556df041034a/vignettes/googleAndCran.png -------------------------------------------------------------------------------- /vignettes/googleBlue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johndharrison/seleniumPipes/53a268dc1496af84278019213f8e556df041034a/vignettes/googleBlue.png -------------------------------------------------------------------------------- /vignettes/onlyCRAN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johndharrison/seleniumPipes/53a268dc1496af84278019213f8e556df041034a/vignettes/onlyCRAN.png -------------------------------------------------------------------------------- /vignettes/windowsGoogle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johndharrison/seleniumPipes/53a268dc1496af84278019213f8e556df041034a/vignettes/windowsGoogle.png --------------------------------------------------------------------------------