@Drone FirefoxDriver browser;
Graphene integrates with Arquillian Drone to simplify process of instantiation of browser session.
So Drone takes care of WebDriver instance creation and configuration and then it delegates this session to Graphene.
Graphene shares the configuration with Drone WebDriver, so you can refer to Drone.
In general, configuration is driven by arquillian.xml and can be overriden by System properties.
You can ask Drone to instantiate any specific implementation of WebDriver like FirefoxDriver, ChromeDriver or HtmlUnitDriver, e.g.:
@Drone FirefoxDriver browser;
But it is recommended to use WebDriver interface and use arquillian.xml to choose appropriate browser instance:
@Drone WebDriver browser;
<arquillian xmlns="http://jboss.com/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> <extension qualifier="webdriver"> <property name="browser">firefox</property> </extension> </arquillian>
For more configuration options, refer to Drone and browser driver implementations.
In order to speed up development, Drone comes with Reusable Remote WebDriver Session feature.
This feature make sure that Drone does not close the browser session on the end of each test,
and it stores the session handle in the pernament storage.
Thus after running first test, browser session is still open and next tests can reuse it.
Since browser session does not have to be opened repeatedly, Drone saves this time
and repeating a test leads into huge time savings.
This enables browser automated tests development as close to unit tests execution time as possible.
Since session is not closed at the end of test, you can tweak anything in browser setup you want including setup of browser debuggers (Firebug, Chrome Dev Tools).
You can for example:
open debugger and watch network usage
insert breakpoints to scripts
watch browser console
Note: it is tempting to use this feature also to speed up test execution - this is not recommended, since then tests can influence each other.
This feature is available only when using remote WebDriver session. So you need to download appropriate version of Selenium Server and start the server:
java -jar selenium-server-standalone-2.35.0.jar
Now Drone can connect to this server and share the session-id across several tests.
You can turn on Reusable Browser Session by following entry:
<arquillian xmlns="http://jboss.com/arquillian" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.org/schema/arquillian http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> <extension qualifier="webdriver"> <property name="remoteReusable">true</property> <property name="remoteAddress">http://localhost:4444/wd/hub/</property> </extension> </arquillian>