WebDriver class Null safety

Interacts with WebDriver.

Implemented types

Constructors

WebDriver(Uri uri, String id, Map<String, dynamic> capabilities, SyncRequestClient _client, WebDriverSpec spec)

Properties

activeElement WebElement?
The currently focused element, or the body element if no element has focus.
read-only
asyncContext SearchContext
Produces a compatible async_core.SearchContext. Allows backwards compatibility with other frameworks.
read-onlyoverride
asyncDriver WebDriver
Produces a async_core.WebDriver with the same session ID. Allows backwards compatibility with other frameworks.
read-only
capabilities Map<String, dynamic>
final
cookies Cookies
read-only
currentUrl String
The current url.
read-only
driver WebDriver
read-onlyoverride
hashCode int
The hash code for this object.
read-onlyinherited
id String
final
keyboard Keyboard
read-only
logs Logs
logs.get(logType) will give list of logs captured in browser.
read-only
mouse Mouse
read-only
pageSource String
An artist's rendition of the current page's source.
read-only
runtimeType Type
A representation of the runtime type of the object.
read-onlyinherited
spec WebDriverSpec
final
switchTo TargetLocator
Changes focus to specified targets.
read-only
timeouts Timeouts
read-only
title String
The title of the current page.
read-only
uri Uri
final
window Window
Handle for the active tab/window.
read-only
windows List<Window>
Handles for all of the currently displayed tabs/windows.
read-only

Methods

addEventListener(SyncWebDriverListener listener) → void
Preferred method for registering listeners. Listeners are expected to return a Future. Use new Future.value() for synchronous listeners.
back() → void
Navigates backwards in the browser history, if possible.
captureElementScreenshotAsBase64(WebElement element) String
Take a screenshot of the specified element as PNG and return it as base64-encoded string.
captureElementScreenshotAsList(WebElement element) List<int>
Take a screenshot of the specified element as PNG as list of uint8.
captureScreenshotAsBase64() String
Take a screenshot of the current page as PNG and return it as base64-encoded string.
captureScreenshotAsList() List<int>
Take a screenshot of the current page as PNG as list of uint8.
close() → void
Closes the current window.
deleteRequest(String command) → dynamic
Performs delete request on command to the WebDriver server.
execute(String script, List args) → dynamic
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. The executed script is assumed to be synchronous and the result of evaluating the script is returned.
executeAsync(String script, List args) → dynamic
Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame. The executed script is assumed to be asynchronous and must signal that is done by invoking the provided callback, which is always provided as the final argument to the function. The value to this callback will be returned to the client.
findElement(By by) WebElement
Search for an element within the entire current page. Throws NoSuchElementException if a matching element is not found.
override
findElementByXpath(String by) WebElement
Search for an element by xpath within the entire current page. Throws NoSuchElementException if a matching element is not found.
findElements(By by) List<WebElement>
Search for multiple elements within the entire current page.
override
forward() → void
Navigates forwards in the browser history, if possible.
get(dynamic url) → void
Navigates to the specified url
getElement(String elementId, [SearchContext? context, dynamic locator, int? index]) WebElement
getRequest(String command) → dynamic
Performs get request on command to the WebDriver server.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
inherited
postRequest(String command, [dynamic params]) → dynamic
Performs post request on command to the WebDriver server.
quit({bool closeSession = true}) → void
Quits the browser.
refresh() → void
Refreshes the current page.
toString() String
A string representation of this object.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited