interface WebDriver implements WebDriverSearchContext (View source)

The interface for WebDriver.

Methods

findElement(WebDriverBy $locator)

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

findElements(WebDriverBy $locator)

Find all WebDriverElements within this element using the given mechanism.

close()

Close the current window.

get(string $url)

Load a new web page in the current browser window.

string
getCurrentURL()

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

string
getPageSource()

Get the source of the last loaded page.

string
getTitle()

Get the title of the current page.

string
getWindowHandle()

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

array
getWindowHandles()

Get all window handles available to the current session.

quit()

Quits this driver, closing every associated window.

string
takeScreenshot(string $save_as = null)

Take a screenshot of the current page.

wait(int $timeout_in_second = 30, int $interval_in_millisecond = 250)

Construct a new WebDriverWait by the current WebDriver instance.

manage()

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

navigate()

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

switchTo()

Switch to a different window or frame.

mixed
execute(string $name, array $params)

No description

Details

WebDriverElement findElement(WebDriverBy $locator)

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

Parameters

WebDriverBy $locator

Return Value

WebDriverElement NoSuchElementException is thrown in HttpCommandExecutor if no element is found.

See also

WebDriverBy

WebDriverElement[] findElements(WebDriverBy $locator)

Find all WebDriverElements within this element using the given mechanism.

Parameters

WebDriverBy $locator

Return Value

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

See also

WebDriverBy

WebDriver close()

Close the current window.

Return Value

WebDriver The current instance.

WebDriver get(string $url)

Load a new web page in the current browser window.

Parameters

string $url

Return Value

WebDriver The current instance.

string getCurrentURL()

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

Return Value

string The current URL.

string getPageSource()

Get the source of the last loaded page.

Return Value

string The current page source.

string getTitle()

Get the title of the current page.

Return Value

string The title of the current page.

string getWindowHandle()

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

Return Value

string The current window handle.

array getWindowHandles()

Get all window handles available to the current session.

Return Value

array An array of string containing all available window handles.

quit()

Quits this driver, closing every associated window.

string takeScreenshot(string $save_as = null)

Take a screenshot of the current page.

Parameters

string $save_as The path of the screenshot to be saved.

Return Value

string The screenshot in PNG format.

WebDriverWait wait(int $timeout_in_second = 30, int $interval_in_millisecond = 250)

Construct a new WebDriverWait by the current WebDriver instance.

Sample usage:

$driver->wait(20, 1000)->until( WebDriverExpectedCondition::titleIs('WebDriver Page') );

Parameters

int $timeout_in_second
int $interval_in_millisecond

Return Value

WebDriverWait

WebDriverOptions manage()

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

Return Value

WebDriverOptions

WebDriverNavigation navigate()

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

Return Value

WebDriverNavigation

See also

WebDriverNavigation

WebDriverTargetLocator switchTo()

Switch to a different window or frame.

Return Value

WebDriverTargetLocator

See also

WebDriverTargetLocator

mixed execute(string $name, array $params)

Parameters

string $name
array $params

Return Value

mixed