org.openqa.selenium.iphone
Class IPhoneDriver

java.lang.Object
  extended by org.openqa.selenium.remote.RemoteWebDriver
      extended by org.openqa.selenium.iphone.IPhoneDriver
All Implemented Interfaces:
HasCapabilities, HasInputDevices, FindsByClassName, FindsByCssSelector, FindsById, FindsByLinkText, FindsByName, FindsByTagName, FindsByXPath, JavascriptExecutor, SearchContext, TakesScreenshot, WebDriver
Direct Known Subclasses:
IPhoneSimulatorDriver

public class IPhoneDriver
extends RemoteWebDriver
implements TakesScreenshot

IPhoneDriver is a driver for running tests on Mobile Safari on the iPhone, iPad and iPod Touch. The driver uses WebDriver's remote REST interface to communicate with the iphone. The iphone (or iphone simulator) must be running the iWebDriver app.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.openqa.selenium.remote.RemoteWebDriver
RemoteWebDriver.RemoteMouse, RemoteWebDriver.RemoteTargetLocator, RemoteWebDriver.RemoteWebDriverOptions
 
Nested classes/interfaces inherited from interface org.openqa.selenium.WebDriver
WebDriver.ImeHandler, WebDriver.Navigation, WebDriver.Options, WebDriver.TargetLocator, WebDriver.Timeouts
 
Field Summary
protected static String DEFAULT_IWEBDRIVER_URL
          This is the default port and URL for iWebDriver.
 
Constructor Summary
IPhoneDriver()
          Create an IPhoneDriver connected to an iphone simulator running on the local machine.
IPhoneDriver(CommandExecutor executor)
          Create an IPhoneDriver that will use the given executor to communicate with the iWebDriver app.
IPhoneDriver(String remoteAddress)
          Create an IPhoneDriver connected to the remote address passed in.
IPhoneDriver(URL remoteAddress)
          Create an IPhoneDriver connected to the remote address passed in.
 
Method Summary
 void close()
          Close the current window, quitting the browser if it's the last window currently open.
<X> X
getScreenshotAs(OutputType<X> target)
          Capture the screenshot and store it in the specified location.
 WebDriver.TargetLocator switchTo()
          Send future commands to a different frame or window.
 
Methods inherited from class org.openqa.selenium.remote.RemoteWebDriver
execute, execute, executeAsyncScript, executeScript, findElement, findElement, findElementByClassName, findElementByCssSelector, findElementById, findElementByLinkText, findElementByName, findElementByPartialLinkText, findElementByTagName, findElementByXPath, findElements, findElements, findElementsByClassName, findElementsByCssSelector, findElementsById, findElementsByLinkText, findElementsByName, findElementsByPartialLinkText, findElementsByTagName, findElementsByXPath, get, getCapabilities, getCommandExecutor, getCurrentUrl, getElementConverter, getErrorHandler, getExecuteMethod, getKeyboard, getMouse, getPageSource, getSessionId, getTitle, getWindowHandle, getWindowHandles, log, manage, navigate, newRemoteWebElement, quit, setCommandExecutor, setElementConverter, startClient, startSession, stopClient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_IWEBDRIVER_URL

protected static final String DEFAULT_IWEBDRIVER_URL
This is the default port and URL for iWebDriver. Eventually it would be nice to use DNS-SD to detect iWebDriver instances running non locally or on non-default ports.

See Also:
Constant Field Values
Constructor Detail

IPhoneDriver

public IPhoneDriver(CommandExecutor executor)
Create an IPhoneDriver that will use the given executor to communicate with the iWebDriver app.

Parameters:
executor - The executor to use for communicating with the iPhone.

IPhoneDriver

public IPhoneDriver(URL remoteAddress)
             throws Exception
Create an IPhoneDriver connected to the remote address passed in.

Parameters:
remoteAddress - The full URL of the remote client (device or simulator).
Throws:
Exception
See Also:
IPhoneDriver(String)

IPhoneDriver

public IPhoneDriver(String remoteAddress)
             throws Exception
Create an IPhoneDriver connected to the remote address passed in.

Parameters:
remoteAddress - The full URL of the remote client running iWebDriver.
Throws:
Exception
See Also:
IPhoneDriver(URL)

IPhoneDriver

public IPhoneDriver()
             throws Exception
Create an IPhoneDriver connected to an iphone simulator running on the local machine.

Throws:
Exception
Method Detail

close

public void close()
Description copied from interface: WebDriver
Close the current window, quitting the browser if it's the last window currently open.

Specified by:
close in interface WebDriver
Overrides:
close in class RemoteWebDriver

switchTo

public WebDriver.TargetLocator switchTo()
Description copied from interface: WebDriver
Send future commands to a different frame or window.

Specified by:
switchTo in interface WebDriver
Overrides:
switchTo in class RemoteWebDriver
Returns:
A TargetLocator which can be used to select a frame or window
See Also:
WebDriver.TargetLocator

getScreenshotAs

public <X> X getScreenshotAs(OutputType<X> target)
Description copied from interface: TakesScreenshot
Capture the screenshot and store it in the specified location.

Specified by:
getScreenshotAs in interface TakesScreenshot
Type Parameters:
X - Return type for getScreenshotAs.
Parameters:
target - target type, @see OutputType
Returns:
Object in which is stored information about the screenshot.


Copyright © 2011. All Rights Reserved.