Skip to content
DevTest Solutions - 8.0.1
Documentation powered by DocOps

Run a Selenium Integration Test Case

Last update June 17, 2015

Contents

Selenium Integration test steps let you import test scripts for web-based user interfaces from Selenium Builder to DevTest Solutions. The recording of these test scripts requires Selenium Builder, which is only supported in Firefox. After you import the test to DevTest, you can run the test in Mozilla Firefox, Google Chrome, Apple Safari, or Internet Explorer. You can also run the test in either a local or remote browser.

You can run Selenium Integration tests like any other test cases in DevTest. However, running these tests in a browser other than Firefox requires more prerequisite tasks. For general information about running a test case, see Running Test Cases and Suites.

Run a Selenium Integration Test on Google Chrome (Local)

This section describes how to run a Selenium Integration test case on Google Chrome on your local computer.

Follow these steps:

  1. Download the Selenium Chrome driver and save it to a local directory.
    1. Go to http://www.seleniumhq.org/download/.
    2. Locate the Chrome driver in the Third Party Browser Drivers NOT DEVELOPED by seleniumhq section and download it.
  2. Add the following properties to the project configuration file you use to run test cases on Chrome.
    • Key: selenium.browser.type
      Value: Chrome
    • Key: selenium.chrome.driver.path
      Value: The full path to the Chrome driver you downloaded. For example: C:\lisa-se\chromedriver.exe.
    Note: Add these properties to project.config before you add them to other project configuration files.
  3. Right-click the selected project configuration file in the Project panel and select Make Active.
  4. Run the test.

Run a Selenium Integration Test on Microsoft Internet Explorer (Local)

This section describes how to run a Selenium Integration test case on Internet Explorer on your local computer.

Follow these steps:

  1. Download the Selenium 32-bit Windows IE driver and save it to a local directory.
    1. Go to http://www.seleniumhq.org/download/.
    2. Locate the 32-bit Windows IE driver in the Internet Explorer Driver Server section and download it.
    Note: Because of a known issue with 64-bit driver performance, we recommend that you install the 32-bit version, even if you use a 64-bit system.
  2. Add the following properties to the project configuration file that you use to run test cases on Internet Explorer.
    • Key: selenium.browser.type
      Value: IE
    • Key: selenium.ie.driver.path
      Value: The full path to the Internet Explorer driver you downloaded. For example: C:\lisa-se\IEDriverServer.exe.
    Note: Add these properties to project.config before you add them to other project configuration files.
  3. Right-click the selected project configuration file in the Project panel and select Make Active.
  4. Modify your Internet Explorer security settings.
    1. Open Internet Explorer.
    2. Click Tools, Internet Options.
    3. Click the Security tab.
    4. Verify that the Enable Protected Mode check box set the same (selected or cleared) for the following zones. If this setting is inconsistent, Selenium does not start.
      • Internet
      • Local Intranet
      • Trusted Sites
      • Restricted Sites
    5. Click OK to save your changes and close the Internet Options window.
  5. Run the test.

Run a Selenium Integration Test on Apple Safari (Local)

This section describes how to run a Selenium Integration test case on Apple Safari on your local computer.

The latest Selenium release includes a Safari web driver and will install and uninstall the web driver extension automatically during execution time, but there is a known issue when you start Safari on Windows the first time or start Safari on Mac OS/X anytime. You could see the error message "Exception in thread "main" org.openqa.selenium.remote.UnreachableBrowserException: Failed to connect to SafariDriver after 10130 ms," and the web driver creation fails. To address the issue, we recommend you install the Safari web driver extension manually, instead of relying on Selenium runtime to install the extension automatically.

Follow these steps:

  1. Locate the SafariDriver.zip file in LISA_HOME\addons\selenium-safari-driver-extension.
  2. Extract the file SafariDriver.safariextz from the zip file into a location that the Safari browser can access.
  3. Start the Safari browser and open the file SafariDriver.safariextz or drag-and-drop the file into the browser.
  4. When the dialog appears, click Install to install the web driver extension.
  5. To confirm that the extension has been installed successfully, view the Preferences, Extensions tab, which has the WebDriver extension listed.
  6. Close the Safari browser.
  7. Add the following property to the project configuration file you use to run test cases on Safari.
    • Key: selenium.browser.type
      Value: Safari
    Note: Add this property to project.config before you add it to other project configuration files.
  8. Right-click the selected project configuration file in the Project panel and select Make Active.
  9. Run the test.

Tip: On Windows, you may encounter a Stale Element Reference Exception issue for Safari release 5.1.7. The error messages appear like the following message:

Caused by: org.openqa.selenium.StaleElementReferenceException: Unable to locate encoded element: ...

Command duration or timeout: 30 milliseconds

For information about this error, see: http://seleniumhq.org/exceptions/stale_element_reference.html.

Rerun the problematic step to recover. See the multi-tier-combo-se.tst in the examples project for an example of using the On Step Fail field to respond to the error.

Run a Selenium Integration Test on a Remote Browser

This section describes how to run a Selenium Integration test case on a remote browser. The remote browser can be Mozilla Firefox, Google Chrome, or Internet Explorer 8.0 or later.

Follow these steps:

  1. Download the Selenium Server and save it to a local directory.
    1. Go to http://www.seleniumhq.org/download/.
    2. Locate the Selenium Server stand-alone .jar file in the Selenium Server (formerly the Selenium RC Server) section and download it.
  2. Verify that the driver for the browser that you want to use is available on the remote computer.
  3. On the remote computer, run the following command from a command prompt:

    java -jar selenium-server-standalone-2.xx.0.jar -role hub

  4. On the remote computer, run the following command from a new command prompt (for Internet Explorer, Firefox, or Chrome):

    java -jar selenium-server-standalone-2.xx.0.jar -role node -hub http://localhost:4444/grid/register -Dwebdriver.chrome.driver=c:\lisa-se\chromedriver.exe -Dwebdriver.ie.driver=c:\lisa-se\IEDriverServer.exe

    For Safari, run the following command from a new command prompt:

    java -jar selenium-server-standalone-2.xx.0.jar -role node -hub http://localhost:4444/grid/register -Dwebdriver.chrome.driver=c:\lisa-se\chromedriver.exe -Dwebdriver.ie.driver=c:\lisa-se\IEDriverServer.exe  -browser browserName=firefox -browser browserName=chrome -browser browserName="internet explorer" -browser browserName=safari

  5. On the local computer, add the following properties to the project configuration file you use for running test cases on the remote browser.
    • Key: selenium.broswer.type
      Values: IE, Firefox, Safari, or Chrome
    • Key: selenium.remote.url
      Value: URL to the remote Selenium Server hub. For example, http://your_remote_hostname:4444/wd/hub.

    If you plan to run Selenium Integration tests on multiple browsers, create a project configuration file for each browser type. You can then run the tests on multiple browsers by making different configuration files active for each test run. For more information about configuration files, see Configurations.

    Note: Add these properties to project.config before you add them to other project configuration files.
  6. Right-click the selected project configuration file in the Project panel and select Make Active.
  7. Run the test.
    The test runs on the selected browser on the remote computer.

    Note: For more information about using Selenium Server in a Grid configuration, see https://code.google.com/p/selenium/wiki/Grid2.
Was this helpful?

Please log in to post comments.