WebDriver

This is a JavaScript wrapper for RemoteWebDriver of Selenium .NET library.

Action Summary

Action Description
Actions Gets Actions object.
ClearSessions Deletes active sessions on Selenium grid.
Close Close the Browser and Dispose of WebDriver.
Cookies Gets Cookies object.
CreateDriver This will create a WebDriver for currently selected Browser profile.
CreateDriverForSession Connects to active Selenium session with given URL and Id.
Dispose Dispose of WebDriver.
DumpSessions Prints information about active Appium sessions to output.
ExecuteScript Executes JavaScript in the context of the currently selected frame or window.
FindElementByClassName Finds the first element in the page that matches the CSS Class supplied.
FindElementByCssSelector Finds the first element matching the specified CSS selector.
FindElementById Finds the first element in the page that matches the ID supplied.
FindElementByLinkText Finds the first of elements that match the link text supplied.
FindElementByName Finds the first of elements that match the name supplied.
FindElementByPartialLinkText Finds the first of elements that match the part of the link text supplied.
FindElementByTagName Finds the first of elements that match the DOM Tag supplied.
FindElementByXPath Finds the first of elements that match the XPath supplied.
FindElementsByClassName Finds a list of elements that match the class name supplied.
FindElementsByCssSelector Finds all elements matching the specified CSS selector.
FindElementsById Finds the first element in the page that matches the ID supplied.
FindElementsByLinkText Finds a list of elements that match the link text supplied.
FindElementsByName Finds a list of elements that match the name supplied.
FindElementsByPartialLinkText Finds a list of elements that match the part of the link text supplied.
FindElementsByTagName Finds a list of elements that match the DOM Tag supplied.
FindElementsByXPath Finds a list of elements that match the XPath supplied.
GetAddressOfRemoteServer
GetCurrentWindowHandle Gets the current window handle, which is an opaque handle to this window that uniquely identifies it within this driver instance.
GetPageSource Gets the source of the page last loaded by the browser.
GetProfileCapability
GetScreenshot Gets the screenshot of the page.
GetScreenshotIW
GetSessionId
GetTitle Gets the title of the current browser window.
GetUrl Gets the URL the browser is currently displaying.
GetWindowHandles Gets the window handles of open browser windows.
Quit Disconnects from the Browser.
ReconnectSession Reads session information produced by SaveSession and connects to the mobile target.
SaveSession Saves session information for use by ReconnectSession.
SetBrowserSize Sets size of a browser window.
SetUrl Sets the URL the browser is currently displaying.
SwitchToAlert Switches to the currently active modal dialog for this particular driver instance.
SwitchToDefaultContent Change the active frame to the default.
SwitchToFrame Move to different frame using its element.
SwitchToLastWindow Switch to last browser window.
SwitchToParentFrame Select the parent frame of the currently selected frame.
SwitchToWindow Switch to window specified by handle.
Window Gets Window object.

Action Detail

Actions()

Gets Actions object.

ClearSessions()

Deletes active sessions on Selenium grid.

Close()

Close the Browser and Dispose of WebDriver.

Cookies()

Gets Cookies object.

CreateDriver(nonProfileCapsJson)

This will create a WebDriver for currently selected Browser profile.

Parameters:

Name Type Description
nonProfileCapsJson object JSON object with capabilities not available in a Browser profile.

Returns:

WebDriver object.

CreateDriverForSession(addressOfRemoteServer, sessionId)

Connects to active Selenium session with given URL and Id.

Parameters:

Name Type Description
addressOfRemoteServer Selenium server URL.
sessionId Id of the session to connect.

Returns:

true if successful, false otherwise.

Dispose()

Dispose of WebDriver.

DumpSessions()

Prints information about active Appium sessions to output.

ExecuteScript(script, args)

Executes JavaScript in the context of the currently selected frame or window.

Parameters:

Name Type Description
script string The JavaScript code to execute.
args array The arguments to the script.

Returns:

Null, string or element depending on the script.

FindElementByClassName(className)

Finds the first element in the page that matches the CSS Class supplied.

Parameters:

Name Type Description
className string CSS class name of the element.

Returns:

element or null.

FindElementByCssSelector(cssSelector)

Finds the first element matching the specified CSS selector.

Parameters:

Name Type Description
cssSelector string The CSS selector to match.

Returns:

element ot null.

FindElementById(id)

Finds the first element in the page that matches the ID supplied.

Parameters:

Name Type Description
id string ID of the element.

Returns:

element or null.

FindElementByLinkText(linkText)

Finds the first of elements that match the link text supplied.

Parameters:

Name Type Description
linkText string Link text of element.

Returns:

element or null.

FindElementByName(name)

Finds the first of elements that match the name supplied.

Parameters:

Name Type Description
name string Name of the element on the page.

Returns:

element or null.

FindElementByPartialLinkText(partialLinkText)

Finds the first of elements that match the part of the link text supplied.

Parameters:

Name Type Description
partialLinkText string Part of the link text.

Returns:

element or null.

FindElementByTagName(tagName)

Finds the first of elements that match the DOM Tag supplied.

Parameters:

Name Type Description
tagName string DOM tag Name of the element being searched.

Returns:

element or null.

FindElementByXPath(xpath)

Finds the first of elements that match the XPath supplied.

Parameters:

Name Type Description
xpath string xpath to the element.

Returns:

element or null.

FindElementsByClassName(className)

Finds a list of elements that match the class name supplied.

Parameters:

Name Type Description
className string className of the element.

Returns:

array of elements.

FindElementsByCssSelector(cssSelector)

Finds all elements matching the specified CSS selector.

Parameters:

Name Type Description
cssSelector string The CSS selector to match.

Returns:

array of elements.

FindElementsById(id)

Finds the first element in the page that matches the ID supplied.

Parameters:

Name Type Description
id string ID of the element.

Returns:

array of elements.

FindElementsByLinkText(linkText)

Finds a list of elements that match the link text supplied.

Parameters:

Name Type Description
linkText Link text of element.

Returns:

array of elements.

FindElementsByName(name)

Finds a list of elements that match the name supplied.

Parameters:

Name Type Description
name string Name of the element on the page.

Returns:

array of elements.

FindElementsByPartialLinkText(partialLinkText)

Finds a list of elements that match the part of the link text supplied.

Parameters:

Name Type Description
partialLinkText string Part of the link text.

Returns:

array of elements.

FindElementsByTagName(tagName)

Finds a list of elements that match the DOM Tag supplied.

Parameters:

Name Type Description
tagName string DOM tag Name of the element being searched.

Returns:

array of elements.

FindElementsByXPath(xpath)

Finds a list of elements that match the XPath supplied.

Parameters:

Name Type Description
xpath string xpath to the element.

Returns:

array of elements.

GetAddressOfRemoteServer()

Returns:

URL of the remote Selenium server.

GetCurrentWindowHandle()

Gets the current window handle, which is an opaque handle to this window that uniquely identifies it within this driver instance.

GetPageSource()

Gets the source of the page last loaded by the browser.

GetProfileCapability(name)

Parameters:

Name Type Description
name

GetScreenshot()

Gets the screenshot of the page.

GetScreenshotIW()

GetSessionId()

Returns:

Id of the current session.

GetTitle()

Gets the title of the current browser window.

GetUrl()

Gets the URL the browser is currently displaying.

GetWindowHandles()

Gets the window handles of open browser windows.

Quit()

Disconnects from the Browser.

ReconnectSession(autoCreate)

Reads session information produced by SaveSession and connects to the mobile target.

Parameters:

Name Type Description
autoCreate boolean 'true' to automatically create a new session if there is no saved session or saved session is not available anymore.
Optional, Default: false.

SaveSession()

Saves session information for use by ReconnectSession.

SetBrowserSize(width, height)

Sets size of a browser window.

Parameters:

Name Type Description
width number Window width to set
height number Window height to set

SetUrl(url)

Sets the URL the browser is currently displaying.

Parameters:

Name Type Description
url string The URL to display

SwitchToAlert()

Switches to the currently active modal dialog for this particular driver instance.

SwitchToDefaultContent()

Change the active frame to the default.

SwitchToFrame(el)

Move to different frame using its element.

Parameters:

Name Type Description
el WebElementWrapper Element of the frame.

SwitchToLastWindow()

Switch to last browser window.

SwitchToParentFrame()

Select the parent frame of the currently selected frame.

SwitchToWindow(windowHandle)

Switch to window specified by handle.

Parameters:

Name Type Description
windowHandle

Window()

Gets Window object.