Selenium WebDriver¶
When developing and testing a web application you naturally need to test it with different web browsers and multiple version of each web browser. With Rapise natively you can record a test script using one browser and then play it back using Google Chrome, Microsoft Edge, Mozilla Firefox or Microsoft Internet Explorer.
In addition, you can use Rapise with the open-source Selenium WebDriver framework to play back the same tests against other browsers such as Apple Safari and Opera (as well as Chrome, Edge, Firefox, IE). You can also use Rapise to write native Selenium code for cases where you want to use existing Selenium WebDriver logic.
Playing & Recording Tests¶
Once you have installed and configured the integration between Rapise and Selenium, we shall discuss how to use Selenium with Rapise to record and play tests.
Now one of the important points is that there are some limitations as to the operations that can be performed using Selenium-based web browsers as opposed to the native browsers supported by Rapise.
Rapise 7.3+¶
In Rapise 7.3 we introduced new Selenium-based recorder. Read more about it in this blog post.
Feature | Rapise Native Browser | Selenium Browser |
---|---|---|
Learn HTML Objects | Yes | Chrome, Edge or WebSpy for any browser |
Record HTML Events | Yes | Chrome, Edge |
Playback HTML Events | Yes | Yes |
Web Spy | Yes | Yes |
Learn Java Applets | Yes | No |
Manual Testing | Yes | No |
Legacy¶
Feature | Rapise Native Browser | Selenium Browser |
---|---|---|
Learn HTML Objects | Yes | (Only in Web Spy) |
Record HTML Events | Yes | No |
Playback HTML Events | Yes | Yes |
Web Spy | Yes | Yes |
Learn Java Applets | Yes | No |
Manual Testing | Yes | No |
So if you are planning on using Rapise to record a test script by clicking HTML objects and having Rapise create the script using the learned objects and adding the events (DoClick, SetText, etc.) then you will need to use one of the native browsers (Chrome, IE, Firefox) or Selenium browsers (Chrome, Edge - requires Rapise 7.3+) to create the test script. You can then playback the same test in either the native or Selenium browsers.
If you are planning on using Rapise to learn objects using the Web Spy, and then create the test script from those objects by either dragging the object methods and properties from the Object Tree into the test script or just using Intellisense to type the methods (DoClick, SetText, etc.) then you can use either a native or Selenium web browser just as easily.
For most users, the primary reason for using the Selenium web browsers will be to playback their tests on a greater number of browsers or to leverage existing Selenium WebDriver scripts created outside of Rapise.
Managing the Selenium Profiles¶
Rapise allows you to maintain different profiles for your different installed Selenium web browsers (both on the same machine as Rapise and also those running on a remote Selenium WebDriver server), To see the different Selenium profiles,
in the main menu select Settings > Selenium
. It will bring up the Selenium profile manager:
By default there is one profile for each of the Selenium WebDriver supported web browsers (Chrome, Edge, Firefox, Internet Explorer, Opera, Safari). However you can clone and change the profiles if you want to have different versions of the browsers (e.g. a local instance of Firefox and one running on a remote Selenium server).
Most users will only need to change the Uri field of the Safari web browser since the defaults are typically sufficient for most testing needs.
Recording using Selenium¶
Rapise 7.3+¶
Select Chrome-based or Edge-based Selenium profile.
Then click Record
button and do the recording like you do it with native browsers.
Legacy¶
To start recording a web test using a Selenium WebDriver based browser, make sure you change the test’s web browser parameter to one of the Selenium profiles:
When you click the Record
button on the main toolbar you will see the following Recording Activity Dialog:
You will notice that the Verify
and Learn
options are not available. If you want to use these tools you will need
to use a native browser (non-Selenium) instead.
When using a Selenium profile for recording, you will need to use the Spy (Ctrl+5) tool to do the learning of objects on the web page. This brings up the Web Spy:
When using the Web Spy with a Selenium profile you will notice that the web browser icon / name shows “Selenium” rather than the browser name and the option to Track an item Ctrl+T is not present. That means you need to select the HTML DOM object in the DOM Tree and learn it from there (rather than clicking on the web page itself which is possible when using a native browser profile).
When you choose to Learn an object in the DOM tree it will be displayed in the Recording Activity Dialog as a new Learned Object:
Objects Learned using a Selenium profile will be added to the Rapise Object Tree in the usual way and as is typical with Learning, you have the option to specify an Action in the Recording Activity Grid (e.g. change Learn to Click) in which case test script code is also generated.
Tip (applies to Rapise 7.2 and older versions): Due to the inherent limitations in recording using a Selenium browser profile (vs. a native browser profile) most users will record their scripts using a native browser and then use Selenium primarily for debugging using the Web Spy and playback.
Playback using Selenium¶
To playback a web test using a Selenium web browser profile, simply choose the appropriate profile in the dropdown located in the top right corner of the main Rapise window:
Then click the Play
button on the main toolbar. The test will now start execution. Unlike recording there is nothing different in the way Rapise handles the playback of a Selenium test. The only difference will be that if the test uses non-HTML technologies such as Java, etc. those parts of the test will fail.
Shadow DOM¶
Since Rapise 7.3 it is possible to view Shadow DOM elements in the Web Spy (works with Selenium Browsers only).
Shadow root elements are marked with the bold label Shadow Root. Use the Web Spy to build a locator for Shadow DOM element and Learn it to add into the object repository.
Info
Locator for a Shadow DOM element has special syntax.