Time for action – using OperaDriver on Opera Mobile - Selenium

To make sure that we have the right amount of coverage over the browsers that users may be using, there is a good chance that you will need to add Opera Mobile. Before starting, make sure that you have downloaded the version of the emulator for your Operating System with one of the links mentioned previously.

  1. Create a new test file. Add the following code to it:

  2. What we now need to do is add a setup method. We will have to add a couple of items to our DesiredCapabilities object.This will tell OperaDriver that we want to work against a mobile version.

  3. Now we can add a test to make sure that we have a working test again:

  4. Let's now add a teardown:

  5. Your class altogether should look like the following:

  6. And the following should appear in your emulator:

What just happened?

We have just seen what is required to run a test against Opera Mobile using OperaDriver. This uses the same communication layer that is used in communicating with the Opera desktop browser called Scope.

We will see the mobile versions of web applications, if they are available, and be able to interact with them.

If you would like the OperaDriver to load up tablet size UI, then you can add the following to use the tablet UI with a display of 1280x800 pixels. This is a common size for tablets that are currently on the market.

c.setCapability("opera.arguments","-tabletui -displaysize 1280x800");

If you want to see the current orientation of the device and to access the touch screen elements, you can swap OperaDriver object for OperaDriverMobile. For the most part, you should be able to do nearly all of your work against the normal driver.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Selenium Topics