Selenium WebDriver – Running the automated test in cloud

We have been using Selenium WebDriver, QTP, JMeter etc in our organization for the automated functional and performance testing. I setup the complete test automation infrastructure and used to do the maintenance. Initially it was fun and later managing everything (Selenium, QTP, JMeter,Influx, Grafana etc) started eating up most of my time. I had to do the testing on multiple browsers and platforms.  On top of that we also wanted to add mobile testing in the scope. Setting up a mobile-lab is not fun. There are so many devices in the market. We can not keep buying new devices every time & update the OS etc. Then I realized that spending money on cloud based services are cost effective and scalable. It will free us our time to concentrate more on developing new tests instead of maintaining the infrastructure.

Now I have been using BrowserStack for our web automated testing on various OS, browsers, mobile devices (iOS and android).

In this post, I would like to show how I achieve this easily using arquillian-drone & graphene.

Arquillian Graphene:

This is 4th post in our arquillian-graphene series. Please read below posts as well if you have not.

  1. Arquillian Drone – Setup
  2. Graphene – Advanced Page Objects using Page fragments
  3. Graphene – Handling Ajax Calls – Fluent Wait API

Arquillian Graphene is a simple wrapper around Selenium WebDriver which gives very powerful utilities for your selenium tests. If you use java for WebDriver automation, then you should definitely give a try. As it is a wrapper, it does not mess up with your existing test scripts. If you want any of the arquillian-drone/graphene features, you can use, otherwise ignore.

Why Arquillian framework:

Arquillian is a simple extension to JUnit/TestNG frameworks. Arquillian itself comes with many extensions and easy to write your own extension.

Arquillian framework maintains all the test configuration in a xml file called arquillian.xml.

We simply maintain all the WebDriver related configurations in this xml file. Whenever we need the driver instance in our test, we use this @Drone annotation as shown below to get the driver injected. So we do not have to write a lot of code to instantiate different browser drivers. Arquillian takes care of all these things for us. All the browser capabilities can be added in the arquillian xml.

	private WebDriver driver;
	public String getTitle(){
		return driver.getTitle();

Running Test Remotely:

I am going to reuse the same test which I had already created as part of this post. Graphene – Advanced Page Objects using Page fragments

Arquillian framework comes with an extension for BrowserStack / SauceLabs.  As I already have BrowserStack subscription, I would be using the BrowserStack extension.

I only had to do 2 updates in my framework to get my tests executed remotely by BrowserStack. 

  • Add Maven dependency for arquillian-browserstack extension
  • Add below properties in the arquillian.xml to run the test on MAC os in chrome browser
	<extension qualifier="webdriver">
        <property name="browser">browserstack</property>
        <property name="username">***********</property>
        <property name="automate.key">**************</property>
        <property name="browserName">chrome</property>
        <property name="platform">MAC</property>
        <property name="browserstack.debug">true</property>

That is it!! I am set to run all my tests remotely in BrowserStack. I do not have to touch my existing code at all.



If I need to run my tests on a mobile device, I do not need appium/selendroid. Arquillian + BrowserStack will take care of it just by updating the arquillian.xml as shown here.

   <extension qualifier="webdriver">
        <property name="browser">browserstack</property>
        <property name="username">***********</property>
        <property name="automate.key">**************</property>
        <property name="browserName">iPad</property>
        <property name="platform">MAC</property>
        <property name="os">ios</property>
        <property name="device">iPad Pro</property>
        <property name="browserstack.debug">true</property>


Arquillian is the best framework I have ever used for JVM/Functional testing. It helps us to write very neat, clean code by keeping the webdriver configurations in a separate file. For the page objects, We do not need a page factory to give us the page object. ‘@Page‘ annotation will give us the page object where ever you need it. Instead of creating a complex page object it also help us to create different page fragments – by decoupling the HTML structure of the page. Check here for more info.

Happy Testing 🙂


Share This:

Categories: Arquillian, Articles, CI / CD / DevOps, Framework, Selenium

Leave a Reply

Your email address will not be published. Required fields are marked *