RedwoodHQ and Selenium

RedwoodHQ can work with almost any test automation tool (Selenium, Appium, Silk, etc.) and code (Java, Groovy, Python, C#). All these tools can be added via Jars, Binaries or Ivy dependency: Jars/Binaries and Ivy
In this part of documentation we will go over some of the most common questions related to Selenium implementation in RedwoodHQ.

Updating to different version of Selenium

Since version 2.5, RedwoodHQ Java/Selenium project is configured to use Selenium version 3.2 and all the binaries associated with that version. As browser versions progress forward so does Selenium in which case you might be required to update it in order for automation to run successfully.

  1. Identify to which version of Selenium you want to update. You can view latest version in official Selenium website
  2. Go to Scripts and on left pane open Ivy.xml (to configure dependency to the new version)
  3. Update all ‘selenium-java’ entries versions to equal to the one you need. For example if you need to configure to version 3.3 you will have the following dependencies:
    “org.seleniumhq.selenium” name=“selenium-java” rev=“3.3.0”
    “org.seleniumhq.selenium” name=“selenium-server” rev=“3.3.0”
    “org.seleniumhq.selenium” name=“selenium-support” rev=“3.3.0”
    Or if you need to always get latest version of selenium then just have ‘rev’ equal to “latest.release”
  4. Do a build to make sure latest dependency works and then push your changes so that other users will have them as well
  5. If you also need to update the binaries which are used by Selenium (like Chrome driver) then you can go to Selenium website and scroll down to see what binaries are there that is required
  6. Download the binaries you need
  7. Go to Scripts and on left pane expand ‘bin’ directory
  8. Delete the binary you want to replace (for example chromedriver.exe)
  9. Right click on ‘bin’ directory, New -> Upload and select the driver you are replacing with (eg: chromedriver.exe)

Setting up Selenium to point at a as specific version of the Browser to test on

One of the things that is problematic for test automation is when Browsers update. It can cause a whole range of issues from user requiring to update to latest selenium version and drivers to something simply failing. A simple example is a case with Chrome 57 where .maximize() method (or any browser resizing) started to give exceptions which required the browser start up to be maximized by default. In a nutshell, it is always good to control the update of Browser when you need to, rather than when they auto-update. Here are the two ways to do it:

  1. Stop Autoupdate
    One of the more simpler ways is to stop auto-update for the browsers. That way you will always have the version that you currently have on your computer/agent box and nothing new will all of a sudden appear to wreck your day.
    Firefox: https://www.technipages.com/enable-disable-automatic-updates-in-firefox
    Chrome (more difficult): http://www.wikihow.com/Completely-Disable-Google-Chrome-Update
    The only problem with this solution is that if someone else will start using automation (or you spin up another agent) then they will by default get whatever browser they currently have on it which could be a version you are not supporting. That’s why a more preferable is the second solution:
  2. Point at a specific version of a Browser
    You can point Selenium at a specific binary of a browser to start up which can be a version that you need. That way you will always point at a specific version of the browser and can even deploy other specific versions to test your automation code with. Here is Chrome as an example.
  • Download and install older version of Chrome (which will work in parallel with your current Chrome). There is no official website that does that unfortunately so I had to do it from this website: https://www.slimjet.com/chrome/google-chrome-old-version.php
  • Modify/Add ChromeOptions to use that binary instead of default one (actions\selenium\Brwoser.groovy), here is a code example (assuming that the version of the chrome was 56 and deployed to autbrowsers directory under C: or root if mac):
    DesiredCapabilities capabilities = DesiredCapabilities.chrome()
    ChromeOptions options = new ChromeOptions()
    if(os.contains("mac")){options.setBinary("/autobrowsers/Chrome.app/Contents/MacOS/Google Chrome")}
    else{options.setBinary("c:\\autobrowsers\\chrome64_56.0.2924.87\\chrome.exe")}
    capabilities.setCapability(ChromeOptions.CAPABILITY, options)
    Driver = new RemoteWebDriver(service.getUrl(),capabilities)
  • Run the automation and it will now use this binary instead of your currently installed version of chrome

Selenium Helper Actions in RedwoodHQ

RedwoodHQ comes (by default) with Selenium Java helper scripts and actions. They are purely optional and are used to get you going with selenium from day one. User has a complete control over that code and can always modify it to suite their needs. The same actions can be called out in Test Cases/Action Collections or even by other Java/Groovy code.
RedwoodHQ does not include helper selenium code in C# or Python but all selenium code in these languages will work identically like in a stand alone IDE. So the tutorials for selenium in these languages should work without any problems (examples: Python Selenium and C# Selenium)

Feedback

Thanks for your feedback.

Post your comment on this topic.

Please do not use this for support questions.
For customer support, please contact us here.

Post Comment