Properties

Methods

__construct()

__construct(\WebDriver  $driver, \WebDriverDispatcher  $dispatcher = null) 

Parameters

\WebDriver $driver
\WebDriverDispatcher $dispatcher

getWebDriver()

getWebDriver() : \WebDriver

Returns

\WebDriver

get()

get(mixed  $url) : $this

Load a new web page in the current browser window.

Parameters

mixed $url

Throws

\WebDriverException

Returns

$this

findElements()

findElements(\WebDriverBy  $by) : array

Parameters

\WebDriverBy $by

Throws

\WebDriverException

Returns

array

executeScript()

executeScript(  $script, array  $arguments = array()) : mixed

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 will be returned.

Parameters

$script
array $arguments

Throws

\WebDriverException

Returns

mixed

executeAsyncScript()

executeAsyncScript(  $script, array  $arguments = array()) : mixed

Inject a snippet of JavaScript into the page for asynchronous execution in the context of the currently selected frame.

The driver will pass a callback as the last argument to the snippet, and block until the callback is invoked.

Parameters

$script
array $arguments

Throws

\WebDriverException

Returns

mixed

close()

close() : $this

Close the current window.

Throws

\WebDriverException

Returns

$this

getCurrentURL()

getCurrentURL() : string

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

Throws

\WebDriverException

Returns

string

getPageSource()

getPageSource() : string

Get the source of the last loaded page.

Throws

\WebDriverException

Returns

string

getTitle()

getTitle() : string

Get the title of the current page.

Throws

\WebDriverException

Returns

string

getWindowHandle()

getWindowHandle() : string

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

Throws

\WebDriverException

Returns

string

getWindowHandles()

getWindowHandles() : array

Get all window handles available to the current session.

Throws

\WebDriverException

Returns

array

quit()

quit() : void

Quits this driver, closing every associated window.

Throws

\WebDriverException

takeScreenshot()

takeScreenshot(null|string  $save_as = null) : string

Take a screenshot of the current page.

Parameters

null|string $save_as

Throws

\WebDriverException

Returns

string

wait()

wait(integer  $timeout_in_second = 30, integer  $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

integer $timeout_in_second
integer $interval_in_millisecond

Throws

\WebDriverException

Returns

\WebDriverWait

manage()

manage() : \WebDriverOptions

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

Throws

\WebDriverException

Returns

\WebDriverOptions

navigate()

navigate() : \EventFiringWebDriverNavigation

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

Throws

\WebDriverException

Returns

\EventFiringWebDriverNavigation

switchTo()

switchTo() : \WebDriverTargetLocator

Switch to a different window or frame.

Throws

\WebDriverException

Returns

\WebDriverTargetLocator

getActiveElement()

getActiveElement() : \WebDriverElement

Get the element on the page that currently has focus.

Returns

\WebDriverElement

execute()

execute(  $name,   $params) : mixed

Parameters

$name
$params

Returns

mixed

dispatch()

dispatch(mixed  $method) : void

Parameters

mixed $method

dispatchOnException()

dispatchOnException(  $exception) 

Parameters

$exception