PHP Class Nearsoft\SeleniumClient\WebDriver

Afficher le fichier Open project: nearsoft/php-selenium-client Class Usage Examples

Méthodes publiques

Méthode 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

Méthode 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 méthode

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
Résultat mixed

__construct() public méthode

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

addCookie() public méthode

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 méthode

Closes current window
public close ( )

deleteAllCookies() public méthode

Delegated method deleteAllCookies to Class Options
public deleteAllCookies ( )

deleteCookieNamed() public méthode

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

executeAsyncScript() public méthode

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

executeScript() public méthode

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

findElement() public méthode

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

findElements() public méthode

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

get() public méthode

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

getCapabilities() public méthode

Gets actual capabilities
public getCapabilities ( ) : Array
Résultat Array of actual capabilities

getCookieNamed() public méthode

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

getCookies() public méthode

Delegated getCookies to Class Options
public getCookies ( ) : Array
Résultat Array

getCurrentSessions() public méthode

Gets information on current selenium sessions
public getCurrentSessions ( ) : Array
Résultat Array of current sessions in hub

getCurrentUrl() public méthode

Gets current url
public getCurrentUrl ( ) : String
Résultat String

getEnvironment() public méthode

Get current Selenium environment
public getEnvironment ( ) : String
Résultat String

getHttpClient() public méthode

Get HttpClient Object
public getHttpClient ( ) : String
Résultat String

getHubUrl() public méthode

Get current Selenium Hub url
public getHubUrl ( ) : String
Résultat String

getPageSource() public méthode

Gets current page source
public getPageSource ( ) : String
Résultat String

getScreenShotsDirectory() public méthode

Get default screenshots directory
public getScreenShotsDirectory ( ) : String
Résultat String

getSessionId() public méthode

Get assigned session id
public getSessionId ( ) : integer
Résultat integer

getTitle() public méthode

Gets current page title
public getTitle ( ) : String
Résultat String

getWindowHandle() public méthode

Gets current window's identifier
public getWindowHandle ( ) : String
Résultat String

getWindowHandles() public méthode

Gets a list of available windows in current session
public getWindowHandles ( ) : Array
Résultat Array

manage() public méthode

Gets Options object
public manage ( ) : Nearsoft\SeleniumClient\Options
Résultat Nearsoft\SeleniumClient\Options

navigate() public méthode

Get Navigation object
public navigate ( ) : Nearsoft\Selenium\Navigation
Résultat Nearsoft\Selenium\Navigation

quit() public méthode

Removes current session
public quit ( )

screenshot() public méthode

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

setEnvironment() public méthode

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

setNavigate() public méthode

Set Navigation
public setNavigate ( $navigate )
$navigate

setScreenShotsDirectory() public méthode

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

setSwitchTo() public méthode

Set Target Locator
public setSwitchTo ( $targetLocator )
$targetLocator

status() public méthode

Get current server's status
public status ( ) : Array
Résultat Array

switchTo() public méthode

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

waitForElementUntilIsNotPresent() public méthode

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

waitForElementUntilIsPresent() public méthode

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