Skip to content

Latest commit

 

History

History
224 lines (171 loc) · 7.47 KB

configuring-drone-instances.adoc

File metadata and controls

224 lines (171 loc) · 7.47 KB

Configuring Drone Instances

Drone instances are automatically configured from arquillian.xml descriptor file or System properties, which take precedence. You can eventually omit the configuration altogether, if you are happy with the default values. Obviously, configurations are compatible with @Qualifier annotations, so you can create a special configuration for a method based life cycle browser if you will.

Extension qualifier must match the value listed in configuration. Otherwise Drone won’t pick the configuration.

The different configuration options supported by Drone are:

Default Drone Configuration

Drone global configuration is applied for all supported frameworks at the same time. It uses drone extension qualifier.

<extension qualifier="drone">
   <property name="instantiationTimeoutInSeconds">120</property>
</extension>
Property Name Default Value Description

instantiationTimeoutInSeconds

60

Default timeout in seconds to get instance of a browser. Set to 0 if you want to disable the timeout altogether

WebDriver configuration

WebDriver uses webdriver qualifier.

<extension qualifier="webdriver">
   <property name="browser">firefox</property>
</extension>
Property Name Default Value Description

browser

htmlUnit

Determines which browser instance is created for WebDriver testing.

Following values are valid:

. chrome
. firefox
. htmlUnit or htmlunit
. internetExplorer or internetexplorer
. opera
. phantomjs
. safari
. edge

iePort

-

Default port where to connect for Internet Explorer driver

remoteAddress

http://localhost:4444/wd/hub

Default address for remote driver to connect

remoteReusable

false

The flag which indicates that remote session should be reused between subsequent executions - gives opportunity to reuse browser window for debugging and/or test execution speed-up.

reuseCookies

false

If you are using remote reusable browser, you can force it to reuse cookies

firefoxExtensions

-

Path or multiple paths to xpi files that will be installed into Firefox instance as extensions. Separate paths using space, use quotes in case that path contains spaces

firefox_profile

-

Path to Firefox Profile to be used instead of default one delivered with FirefoxDriver

firefoxUserPreferences

-

Path to Firefox user preferences. This file will be parsed and values will be applied to freshly created Firefox profile.

htmlUnitWebClientOptions

-

Semicolon separated list of webClientOptions for HtmlUnitDriver. e.g. timeout=10; javaScriptEnabled=true; throwExceptionOnScriptError=false; SSLClientProtocols=protocal1, protocal2

dimensions

-

Dimensions of browser window in widthxheight format. This will resize the window if supported by underlying browser. Useful for phantomjs, which by default defines a very small viewport. If you need the browser in fullscreen mode, use any of the following strings: "full" "fullscreen" "max"

Some additional configuration parameters related to binaries can be found in Properties, directory names and support of latest versions

If you need to enable any browser capability, simply specify it as a property in extension configuration. For instance, if you are running Firefox browser and you want to change the binary location, you can do it via following code:

<extension qualifier="webdriver">
   <property name="firefox_binary">/path/to/firefox</property>
</extension>

We have enabled JavaScript for htmlUnit driver by default. If you want to disable it, configure appropriate capability to false:

<property name="javascriptEnabled">false</property>

WebDriver expects a Java Object stored in Capabilities settings for some of the WebDriver capabilities. Therefore, we provide a simple mappings to text format for some properties described in table below.

Property Name Format

loggingPrefs

Comma separated list of logging levels for FirefoxDriver. Use driver=${value1},profiler=${value2} where value is one of the following: SEVERE, WARNING, INFO, CONFIG, FINE, FINER or FINEST

Graphene 2 Configuration

Graphene 2 reuses configuration specified for WebDriver, using webdriver qualifier. You can additionally use a Arquillian Graphene 2 configuration to set Graphene specific configuration, such as default UI timeouts.

Selenium Server Configuration

Selenium server is automatically started with the parameter reflecting browser that is used (path to the webdriver). For example, in case that the browser Firefox is used and with default address, then the Selenium Server instance would be started using a command:

java -Dwebdriver.gecko.driver=target/…​/geckodriver -jar target/…​/selenium-server-standalone-3.4.0.jar -port 4444

In case you would like to add some additional selenium server arguments to the command, you can use parameter seleniumServerArgs in your arquillian.xml file. For example, if you used these properties:

<property name="seleniumServerArgs">-debug true -role node -browserTimeout 1000</property>
<property name="browser">firefox</property>

then the command used for starting Selenium Server instance would look like:

java -Dwebdriver.gecko.driver=target/…​/geckodriver -jar target/…​/selenium-server-standalone-3.4.0.jar -port 4444 -debug true -role node -browserTimeout 1000

Extended Configuration: Configuring @Qualifier’d Drone Instances

If you are wondering how to define configuration for @Qualifier @Drone instance, it’s very easy. Only modification you have to do is to change qualifier to include - (@Qualifier annotation name converted to lowercase). For instance, if you qualified Arquillian Graphene instance with @MyExtraBrowser, its extension qualifier will become graphene-myextrabrowser.

Arquillian Drone configures your browser using two-step process:

  1. Search for the exact match of qualifier (e.g. graphene-myextrabrowser) in arquillian.xml, if found, step 2 is not performed.

  2. Search for a match of base qualifier, without type safe @Qualifier (e.g. graphene) in arquillian.xml.

Then System property are applied in the same fashion.

Skipping creation of @Drone instances

In case you want to skip a creation/injection of @Drone instances you can use a system property arquillian.drone.skip.creation with a value true. This property is checked in a @Before phase, so you can modify the property during the test execution.