org.openqa.selenium.android.library
Class ChromeClientWrapper

java.lang.Object
  extended by org.openqa.selenium.android.library.ChromeClientWrapper
All Implemented Interfaces:
DriverProvider, ViewProvider

public class ChromeClientWrapper
extends Object
implements DriverProvider, ViewProvider

This class wraps a chrome client that must have the *same* API as WebChromeClient. This chrome client will be used with the view used by WebDriver to monitor events.

Sample usage: // If the underlying view is a WebView, you can use WebDriver's default // chrome client assuming you don't have any custom bahavior defined in // WebView's WebChromeClient. ChromeClientWrapper chromeClient = new ChromeClientWrapper( "android.webkit.WebChromeClient", new DefaultChromeClient()); // If the underlying view is a WebView, you can use WebDriver default // chrome client with a custom WebChromeClient that defines the bahavior // you want. class MyCustomChromeClient extends WebChromeClient { ... } MyCustomChromeClient customChrome = new MyCustomChromeClient(); ChromeClientWrapper chromeClient = new ChromeClientWrapper( "android.webkit.WebChromeClient", new DefaultChromeClient(customChrome)) Note that WebDriver needs the DefaultChromeClient in order to be able to listen to events that happen on the page. If you don't want to use the DefaultChromeClient, you can write your own client under the condition that your client calls all WebDriverChromeClient methods.


Constructor Summary
ChromeClientWrapper(String className, Object client)
           
 
Method Summary
 void setDriver(AndroidWebDriver driver)
           
 void setWebDriverView(org.openqa.selenium.android.library.WebDriverView view)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChromeClientWrapper

public ChromeClientWrapper(String className,
                           Object client)
Parameters:
className - the fully qualified class name of the client's class.
client - the client to use. Typically this client will be a WebChromeClient (or extend the latter). if not this client must have the same API methods as WebChromeClient. Additionally this chrome client must implement the DriverProvider and ViewProvider interfaces.
Method Detail

setDriver

public void setDriver(AndroidWebDriver driver)
Specified by:
setDriver in interface DriverProvider

setWebDriverView

public void setWebDriverView(org.openqa.selenium.android.library.WebDriverView view)
Specified by:
setWebDriverView in interface ViewProvider


Copyright © 2013. All Rights Reserved.