WebDriver
extends
WebDriverSearchContext
in
The interface for WebDriver.
Table of Contents
Methods
- close() : WebDriver
- Close the current window.
- execute() : mixed
- findElement() : WebDriverElement
- Find the first WebDriverElement within this element using the given mechanism.
- findElements() : array<string|int, WebDriverElement>
- Find all WebDriverElements within this element using the given mechanism.
- get() : WebDriver
- Load a new web page in the current browser window.
- getCurrentURL() : string
- Get a string representing the current URL that the browser is looking at.
- getPageSource() : string
- Get the source of the last loaded page.
- getTitle() : string
- Get the title of the current page.
- getWindowHandle() : string
- Return an opaque handle to this window that uniquely identifies it within this driver instance.
- getWindowHandles() : array<string|int, mixed>
- Get all window handles available to the current session.
- manage() : WebDriverOptions
- An abstraction for managing stuff you would do in a browser menu. For example, adding and deleting cookies.
- navigate() : WebDriverNavigationInterface
- An abstraction allowing the driver to access the browser's history and to navigate to a given URL.
- quit() : mixed
- Quits this driver, closing every associated window.
- switchTo() : WebDriverTargetLocator
- Switch to a different window or frame.
- takeScreenshot() : string
- Take a screenshot of the current page.
- wait() : WebDriverWait
- Construct a new WebDriverWait by the current WebDriver instance.
Methods
close()
Close the current window.
public
close() : WebDriver
Return values
WebDriver —The current instance.
execute()
public
execute(string $name, array<string|int, mixed> $params) : mixed
Parameters
- $name : string
- $params : array<string|int, mixed>
findElement()
Find the first WebDriverElement within this element using the given mechanism.
public
findElement(WebDriverBy $locator) : WebDriverElement
Parameters
- $locator : WebDriverBy
Tags
Return values
WebDriverElementfindElements()
Find all WebDriverElements within this element using the given mechanism.
public
findElements(WebDriverBy $locator) : array<string|int, WebDriverElement>
Parameters
- $locator : WebDriverBy
Tags
Return values
array<string|int, WebDriverElement> —A list of all WebDriverElements, or an empty array if nothing matches
get()
Load a new web page in the current browser window.
public
get(string $url) : WebDriver
Parameters
- $url : string
Return values
WebDriver —The current instance.
getCurrentURL()
Get a string representing the current URL that the browser is looking at.
public
getCurrentURL() : string
Return values
string —The current URL.
getPageSource()
Get the source of the last loaded page.
public
getPageSource() : string
Return values
string —The current page source.
getTitle()
Get the title of the current page.
public
getTitle() : string
Return values
string —The title of the current page.
getWindowHandle()
Return an opaque handle to this window that uniquely identifies it within this driver instance.
public
getWindowHandle() : string
Return values
string —The current window handle.
getWindowHandles()
Get all window handles available to the current session.
public
getWindowHandles() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of string containing all available window handles.
manage()
An abstraction for managing stuff you would do in a browser menu. For example, adding and deleting cookies.
public
manage() : WebDriverOptions
Return values
WebDriverOptionsnavigate()
An abstraction allowing the driver to access the browser's history and to navigate to a given URL.
public
navigate() : WebDriverNavigationInterface
Tags
Return values
WebDriverNavigationInterfacequit()
Quits this driver, closing every associated window.
public
quit() : mixed
switchTo()
Switch to a different window or frame.
public
switchTo() : WebDriverTargetLocator
Tags
Return values
WebDriverTargetLocatortakeScreenshot()
Take a screenshot of the current page.
public
takeScreenshot([string $save_as = null ]) : string
Parameters
- $save_as : string = null
-
The path of the screenshot to be saved.
Return values
string —The screenshot in PNG format.
wait()
Construct a new WebDriverWait by the current WebDriver instance.
public
wait([int $timeout_in_second = 30 ][, int $interval_in_millisecond = 250 ]) : WebDriverWait
Sample usage:
$driver->wait(20, 1000)->until( WebDriverExpectedCondition::titleIs('WebDriver Page') );
Parameters
- $timeout_in_second : int = 30
- $interval_in_millisecond : int = 250