PHP Class Nearsoft\SeleniumClient\WebDriver

Mostrar archivo Open project: nearsoft/php-selenium-client Class Usage Examples

Public Methods

Method Description
__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

Private Methods

Method Description
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

Method Details

__call() public method

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
return mixed

__construct() public method

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

addCookie() public method

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() public method

Closes current window
public close ( )

deleteAllCookies() public method

Delegated method deleteAllCookies to Class Options
public deleteAllCookies ( )

deleteCookieNamed() public method

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

executeAsyncScript() public method

Execute async javascript on page
public executeAsyncScript ( String $script, Array $args = null ) : String
$script String
$args Array
return String

executeScript() public method

Executes javascript on page
public executeScript ( String $script, Array $args = null ) : String
$script String
$args Array
return String

findElement() public method

Gets an element within current page
public findElement ( By $locator, boolean $polling = false, integer $elementId ) : Nearsoft\SeleniumClient\WebElement
$locator By
$polling boolean
$elementId integer
return Nearsoft\SeleniumClient\WebElement

findElements() public method

Gets elements within current page
public findElements ( By $locator, boolean $polling = false, integer $elementId ) : Nearsoft\SeleniumClient\WebElement[]
$locator By
$polling boolean
$elementId integer
return Nearsoft\SeleniumClient\WebElement[]

get() public method

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

getCapabilities() public method

Gets actual capabilities
public getCapabilities ( ) : Array
return Array of actual capabilities

getCookieNamed() public method

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

getCookies() public method

Delegated getCookies to Class Options
public getCookies ( ) : Array
return Array

getCurrentSessions() public method

Gets information on current selenium sessions
public getCurrentSessions ( ) : Array
return Array of current sessions in hub

getCurrentUrl() public method

Gets current url
public getCurrentUrl ( ) : String
return String

getEnvironment() public method

Get current Selenium environment
public getEnvironment ( ) : String
return String

getHttpClient() public method

Get HttpClient Object
public getHttpClient ( ) : String
return String

getHubUrl() public method

Get current Selenium Hub url
public getHubUrl ( ) : String
return String

getPageSource() public method

Gets current page source
public getPageSource ( ) : String
return String

getScreenShotsDirectory() public method

Get default screenshots directory
public getScreenShotsDirectory ( ) : String
return String

getSessionId() public method

Get assigned session id
public getSessionId ( ) : integer
return integer

getTitle() public method

Gets current page title
public getTitle ( ) : String
return String

getWindowHandle() public method

Gets current window's identifier
public getWindowHandle ( ) : String
return String

getWindowHandles() public method

Gets a list of available windows in current session
public getWindowHandles ( ) : Array
return Array

manage() public method

Gets Options object
public manage ( ) : Nearsoft\SeleniumClient\Options
return Nearsoft\SeleniumClient\Options

navigate() public method

Get Navigation object
public navigate ( ) : Nearsoft\Selenium\Navigation
return Nearsoft\Selenium\Navigation

quit() public method

Removes current session
public quit ( )

screenshot() public method

Takes screenshot of current screen, saves it in specified default directory or as specified in parameter
public screenshot ( String $overrideScreenshotsDirectory = null ) : string
$overrideScreenshotsDirectory String
return string

setEnvironment() public method

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

setNavigate() public method

Set Navigation
public setNavigate ( $navigate )
$navigate

setScreenShotsDirectory() public method

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

setSwitchTo() public method

Set Target Locator
public setSwitchTo ( $targetLocator )
$targetLocator

status() public method

Get current server's status
public status ( ) : Array
return Array

switchTo() public method

Creates new target locator to be handled
public switchTo ( ) : Nearsoft\SeleniumClient\TargetLocator
return Nearsoft\SeleniumClient\TargetLocator

waitForElementUntilIsNotPresent() public method

Stops the process until an element is not found
public waitForElementUntilIsNotPresent ( By $locator, integer $timeOutSeconds = 5 ) : boolean
$locator By
$timeOutSeconds integer
return boolean true when element is gone, false if element is still there

waitForElementUntilIsPresent() public method

Stops the process until an element is found
public waitForElementUntilIsPresent ( By $locator, integer $timeOutSeconds = 5 ) : Nearsoft\SeleniumClient\WebElement
$locator By
$timeOutSeconds integer
return Nearsoft\SeleniumClient\WebElement