forked from chenkan/Dagger
-
Notifications
You must be signed in to change notification settings - Fork 160
Use Selenium's API
andrewleo edited this page Nov 2, 2013
·
6 revisions
As we know Selenium
provides lots of API and Dagger
only uses some of them.
Dagger also provides API to get RemoteWebDriver
& WebDriverBackedSelenium
instance which are embedded in BrowserEmulator
instance, then you can use Selenium's native API. So it's better to get familiar with Selenium's API.
Sample code
BrowserEmulator be = new BrowserEmulator();
// Get RemoteWebDriver instance
RemoteWebDriver wd = be.getBrowserCore();
wd.get("http://www.dagger.com");
wd.findElementByXPath("//input[@name='dagger']");
wd.executeScript("alert('hello dagger')");
// Get WebDriverBackedSelenium instance
WebDriverBackedSelenium wbs = be.getBrowser();
wbs.getCookie();
wbs.getAllWindowTitles();