PHP Класс Nearsoft\SeleniumClient\WebDriver

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
__call ( string $name, array $args ) : mixed Enables Navigation's methods be invoked as navigationNameMethod Example: navigationRefresh, navigationBack.
__construct ( DesiredCapabilities $desiredCapabilities = null, String $host = "http://localhost", integer $port = 4444 )
addCookie ( $name, $value, null $path = null, null $domain = null, null $secure = null, null $expiry = null ) Delegated addCookies to Class Options
close ( ) Closes current window
deleteAllCookies ( ) Delegated method deleteAllCookies to Class Options
deleteCookieNamed ( $cookieName ) Delegated method deleteCookieName to Class Options
executeAsyncScript ( String $script, Array $args = null ) : String Execute async javascript on page
executeScript ( String $script, Array $args = null ) : String Executes javascript on page
findElement ( By $locator, boolean $polling = false, integer $elementId ) : Nearsoft\SeleniumClient\WebElement Gets an element within current page
findElements ( By $locator, boolean $polling = false, integer $elementId ) : Nearsoft\SeleniumClient\WebElement[] Gets elements within current page
get ( String $url ) Navigates to specified url
getCapabilities ( ) : Array Gets actual capabilities
getCookieNamed ( $cookieName ) Delegated method getCookieNamed to Class Options
getCookies ( ) : Array Delegated getCookies to Class Options
getCurrentSessions ( ) : Array Gets information on current selenium sessions
getCurrentUrl ( ) : String Gets current url
getEnvironment ( ) : String Get current Selenium environment
getHttpClient ( ) : String Get HttpClient Object
getHubUrl ( ) : String Get current Selenium Hub url
getPageSource ( ) : String Gets current page source
getScreenShotsDirectory ( ) : String Get default screenshots directory
getSessionId ( ) : integer Get assigned session id
getTitle ( ) : String Gets current page title
getWindowHandle ( ) : String Gets current window's identifier
getWindowHandles ( ) : Array Gets a list of available windows in current session
manage ( ) : Nearsoft\SeleniumClient\Options Gets Options object
navigate ( ) : Nearsoft\Selenium\Navigation Get Navigation object
quit ( ) Removes current session
screenshot ( String $overrideScreenshotsDirectory = null ) : string Takes screenshot of current screen, saves it in specified default directory or as specified in parameter
setEnvironment ( String $value ) Set whether production or testing mode for library
setNavigate ( $navigate ) Set Navigation
setScreenShotsDirectory ( String $value ) Sets default screenshots directory for files to be stored in
setSwitchTo ( $targetLocator ) Set Target Locator
status ( ) : Array Get current server's status
switchTo ( ) : Nearsoft\SeleniumClient\TargetLocator Creates new target locator to be handled
waitForElementUntilIsNotPresent ( By $locator, integer $timeOutSeconds = 5 ) : boolean Stops the process until an element is not found
waitForElementUntilIsPresent ( By $locator, integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement Stops the process until an element is found

Приватные методы

Метод Описание
callFindElement ( $name, array $args ) Call findElement and findElement methods
callNavigationMethods ( $name, $args ) Call Navigation Methods
callSwitchTo ( $name, array $args ) : mixed Call Target Locator Methods
callWindowMethods ( $name, $args ) : array Call Navigation Methods
executeScriptInternal ( String $script, boolean $async, Array $args ) : String Executes javascript on page
startSession ( DesiredCapabilities $desiredCapabilities ) Starts new Selenium session

Описание методов

__call() публичный Метод

Enables window's methods be invoked Example: windowMaximize, windowGetPosition. Enables TargetLocator's methods Examples: switchToWindow, switchToFrame Enables findElement and findElements methods be invoked through method missing. The methods should be invoked with the format 'findElementBy'. Arguments should match those required by findElement and findElements methods. i.e. findElementByCssSelector, findElementByTagName, findElementsByXPath
public __call ( string $name, array $args ) : mixed
$name string
$args array
Результат mixed

__construct() публичный Метод

public __construct ( DesiredCapabilities $desiredCapabilities = null, String $host = "http://localhost", integer $port = 4444 )
$desiredCapabilities DesiredCapabilities
$host String
$port integer

addCookie() публичный Метод

Delegated addCookies to Class Options
public addCookie ( $name, $value, null $path = null, null $domain = null, null $secure = null, null $expiry = null )
$name
$value
$path null
$domain null
$secure null
$expiry null

close() публичный Метод

Closes current window
public close ( )

deleteAllCookies() публичный Метод

Delegated method deleteAllCookies to Class Options
public deleteAllCookies ( )

deleteCookieNamed() публичный Метод

Delegated method deleteCookieName to Class Options
public deleteCookieNamed ( $cookieName )
$cookieName

executeAsyncScript() публичный Метод

Execute async javascript on page
public executeAsyncScript ( String $script, Array $args = null ) : String
$script String
$args Array
Результат String

executeScript() публичный Метод

Executes javascript on page
public executeScript ( String $script, Array $args = null ) : String
$script String
$args Array
Результат String

findElement() публичный Метод

Gets an element within current page
public findElement ( By $locator, boolean $polling = false, integer $elementId ) : Nearsoft\SeleniumClient\WebElement
$locator By
$polling boolean
$elementId integer
Результат Nearsoft\SeleniumClient\WebElement

findElements() публичный Метод

Gets elements within current page
public findElements ( By $locator, boolean $polling = false, integer $elementId ) : Nearsoft\SeleniumClient\WebElement[]
$locator By
$polling boolean
$elementId integer
Результат Nearsoft\SeleniumClient\WebElement[]

get() публичный Метод

Navigates to specified url
public get ( String $url )
$url String

getCapabilities() публичный Метод

Gets actual capabilities
public getCapabilities ( ) : Array
Результат Array of actual capabilities

getCookieNamed() публичный Метод

Delegated method getCookieNamed to Class Options
public getCookieNamed ( $cookieName )
$cookieName

getCookies() публичный Метод

Delegated getCookies to Class Options
public getCookies ( ) : Array
Результат Array

getCurrentSessions() публичный Метод

Gets information on current selenium sessions
public getCurrentSessions ( ) : Array
Результат Array of current sessions in hub

getCurrentUrl() публичный Метод

Gets current url
public getCurrentUrl ( ) : String
Результат String

getEnvironment() публичный Метод

Get current Selenium environment
public getEnvironment ( ) : String
Результат String

getHttpClient() публичный Метод

Get HttpClient Object
public getHttpClient ( ) : String
Результат String

getHubUrl() публичный Метод

Get current Selenium Hub url
public getHubUrl ( ) : String
Результат String

getPageSource() публичный Метод

Gets current page source
public getPageSource ( ) : String
Результат String

getScreenShotsDirectory() публичный Метод

Get default screenshots directory
public getScreenShotsDirectory ( ) : String
Результат String

getSessionId() публичный Метод

Get assigned session id
public getSessionId ( ) : integer
Результат integer

getTitle() публичный Метод

Gets current page title
public getTitle ( ) : String
Результат String

getWindowHandle() публичный Метод

Gets current window's identifier
public getWindowHandle ( ) : String
Результат String

getWindowHandles() публичный Метод

Gets a list of available windows in current session
public getWindowHandles ( ) : Array
Результат Array

manage() публичный Метод

Gets Options object
public manage ( ) : Nearsoft\SeleniumClient\Options
Результат Nearsoft\SeleniumClient\Options

navigate() публичный Метод

Get Navigation object
public navigate ( ) : Nearsoft\Selenium\Navigation
Результат Nearsoft\Selenium\Navigation

quit() публичный Метод

Removes current session
public quit ( )

screenshot() публичный Метод

Takes screenshot of current screen, saves it in specified default directory or as specified in parameter
public screenshot ( String $overrideScreenshotsDirectory = null ) : string
$overrideScreenshotsDirectory String
Результат string

setEnvironment() публичный Метод

Set whether production or testing mode for library
public setEnvironment ( String $value )
$value String

setNavigate() публичный Метод

Set Navigation
public setNavigate ( $navigate )
$navigate

setScreenShotsDirectory() публичный Метод

Sets default screenshots directory for files to be stored in
public setScreenShotsDirectory ( String $value )
$value String

setSwitchTo() публичный Метод

Set Target Locator
public setSwitchTo ( $targetLocator )
$targetLocator

status() публичный Метод

Get current server's status
public status ( ) : Array
Результат Array

switchTo() публичный Метод

Creates new target locator to be handled
public switchTo ( ) : Nearsoft\SeleniumClient\TargetLocator
Результат Nearsoft\SeleniumClient\TargetLocator

waitForElementUntilIsNotPresent() публичный Метод

Stops the process until an element is not found
public waitForElementUntilIsNotPresent ( By $locator, integer $timeOutSeconds = 5 ) : boolean
$locator By
$timeOutSeconds integer
Результат boolean true when element is gone, false if element is still there

waitForElementUntilIsPresent() публичный Метод

Stops the process until an element is found
public waitForElementUntilIsPresent ( By $locator, integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement
$locator By
$timeOutSeconds integer
Результат Nearsoft\SeleniumClient\WebElement