Tips and Tricks
Choosing between Marionette and Firefox drivers
testDestination system property defines the browser that Iridium tests will be run against, and you may notice that you have the option to specify either
Marionette to run tests against the Firefox web browser. Why are there two options and which one do you pick?
The short answer is use
Marionette for recent versions of Firefox.
The long answer involves some history about Firefox and Selenium.
With version 48, Firefox forced the use of signed extensions. Until this point, Selenium used an unsigned XPI to communicate with Firefox, but with version 48 this extension stopped working.
Selenium then had two classes that represented each of these drivers: one for Firefox and one for Marionette. From Selenium's point of view Firefox and Marionette were essentially two different browsers.
These days Selenium has removed the Marionette driver and now just has the one Firefox driver, but for the sake of compatibility Iridium still allows users to select between Marionette and Firefox as test destinations.
Finding invalid links
The following test script can be used to find bad links in a web page. This test specifically tests this very page, which has a dead link down below.
You can run this script by right clicking and saving this web start file.
Feature: Open an application # Open up the web page Scenario: Launch App And I set the default wait time between steps to "2" And I open the url "https://autogeneral.gitbooks.io/iridiumapplicationtesting-gettingstartedguide/content/tips_and_tricks.html" And I maximise the window # This step find all the <a> elements and opens all their href urls And I open all links in new tabs and then close the tabs Scenario: Verify Response Codes # This step reports on any http requests that resulted in HTTP errors. # Typically, when used in conjunction with the # "I open all links in new tabs and then close the tabs" step, these # errors means your site has dead links. And I verify that there were no HTTP errors
If you run this test against this page, this link will be flagged as invalid.
Running tests in IE 11
You may see the following error when attempting to run tests in IE 11:
This can be resolved by adding the site you are testing to the list of trusted sites.
If you see errors like
Unable to get browser follow the advice in this issue:
According to Jim Evans: "I've had a little more time to look at this now. I've tested it against the Windows 8.1 preview build available for download from Microsoft. The good news is that it looks like the IE driver *mostly* works with IE11, provided that (a) all security zones are set to the same Protected Mode setting and (b) Enhanced Protected Mode is turned off. Note that the standard registry checks that the IE driver uses to test for Protected Mode settings in IE7-10 are broken for IE11, and we've never made any attempt to check for Enhanced Protected Mode, so there's no warning (yet) if you don't have these settings properly set. The bad news is that cookie manipulation is broken. Badly. If you attempt to set or retrieve cookies, there's a chance that you'll end up with the "Unable to get browser" error encountered before. At the moment, there is no workaround for that. Matt, looking at the log you posted earlier, it looks like you were doing some cookie manipulation before you got into the bad state."
Browsers fail to open web pages after running test in IE
The IE WebDriver will set the browser proxy settings, and a crash or termmination of Iridium can leave this proxy information in place. The result is that no browser will be able to open a web page, even though web sites can be resolved and pinged from a command line.
To fix this open up Internet Options, click the Connections tab, click LAN settings, and remove any proxy information.
Clearing the Java Cache
To force Java Web Start to download the latest version of Iridium, you need to clear the Java cache. Open the Java control panel, click Settings -> Delete Files -> All.
Finding XPaths and CSS Selectors
The Chrome developer tools give you an easy way to find the XPath and CSS selectors for an element. Right click on the element, select Copy, and then select Copy XPath.
Besides the Chrome developer tools, there are some Firefox add-ons extensions also which could help you to locate web elements. For example, WebDriver Element Locator is one of them. To use this extension, simply right click on the web element you wish to locate, select an appropriate locator string and it'll be copied to your clipboard.
HTTPS sites not loading with BrowserMob
With BrowserMob enabled, you may find that HTTPS sites don't load when Iridium is run with OpenJDK. Installing the Oracle JDK has been shown to fix this issue.
Zooming in or out of a page
Where '90%' is equal to the desired zoom level.