\WebDriver

The interface for WebDriver.

Summary

Methods
Constants
findElement()
findElements()
close()
get()
getCurrentURL()
getPageSource()
getTitle()
getWindowHandle()
getWindowHandles()
quit()
takeScreenshot()
wait()
manage()
navigate()
switchTo()
execute()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

findElement()

findElement(\WebDriverBy  $locator) : \WebDriverElement

Find the first WebDriverElement within this element using the given mechanism.

Parameters

\WebDriverBy $locator

Returns

\WebDriverElement —

NoSuchElementException is thrown in HttpCommandExecutor if no element is found.

findElements()

findElements(\WebDriverBy  $locator) : array

Find all WebDriverElements within this element using the given mechanism.

Parameters

\WebDriverBy $locator

Returns

array —

A list of all WebDriverElements, or an empty array if nothing matches

close()

close() : \WebDriver

Close the current window.

Returns

\WebDriver —

The current instance.

get()

get(  $url) : \WebDriver

Load a new web page in the current browser window.

Parameters

$url

Returns

\WebDriver —

The current instance.

getCurrentURL()

getCurrentURL() : string

Get a string representing the current URL that the browser is looking at.

Returns

string —

The current URL.

getPageSource()

getPageSource() : string

Get the source of the last loaded page.

Returns

string —

The current page source.

getTitle()

getTitle() : string

Get the title of the current page.

Returns

string —

The title of the current page.

getWindowHandle()

getWindowHandle() : string

Return an opaque handle to this window that uniquely identifies it within this driver instance.

Returns

string —

The current window handle.

getWindowHandles()

getWindowHandles() : array

Get all window handles available to the current session.

Returns

array —

An array of string containing all available window handles.

quit()

quit() : void

Quits this driver, closing every associated window.

takeScreenshot()

takeScreenshot(string  $save_as = null) : string

Take a screenshot of the current page.

Parameters

string $save_as

The path of the screenshot to be saved.

Returns

string —

The screenshot in PNG format.

wait()

wait(  $timeout_in_second = 30,   $interval_in_millisecond = 250) : \WebDriverWait

Construct a new WebDriverWait by the current WebDriver instance.

Sample usage:

$driver->wait(20, 1000)->until(

WebDriverExpectedCondition::titleIs('WebDriver Page')

);

Parameters

$timeout_in_second
$interval_in_millisecond

Returns

\WebDriverWait

manage()

manage() : \WebDriverOptions

An abstraction for managing stuff you would do in a browser menu. For example, adding and deleting cookies.

Returns

\WebDriverOptions

navigate()

navigate() : \WebDriverNavigation

An abstraction allowing the driver to access the browser's history and to navigate to a given URL.

Returns

\WebDriverNavigation

switchTo()

switchTo() : \WebDriverTargetLocator

Switch to a different window or frame.

Returns

\WebDriverTargetLocator

execute()

execute(string  $name, array  $params) : mixed

Parameters

string $name
array $params

Returns

mixed