This page is maintained for older versions of Rapise only. The latest documentation can be found at:
Using Native Selenium Code

When using the standard Rapise Record, Learn, and Web Spy tools you can create your web tests using the Rapise built-in Object Tree. This lets you design your tests using a higher level of abstraction than working directly with Selenium WebDriver.

For example you can learn an object SeS("EditButton") that points to a dynamic XPATH or CSS query that the automation engineer knows will be accurate even if the data on the page changes (for example). The QA analyst can then simply drag and drop these Rapise objects from the Object Tree into the test script (e.g. SeS("EditButton").DoClick()) to perform the desired action.

Sometimes however you will want to be able to run standard Selenium raw WebDriver code inside Rapise using the standard Selenium WebDriver API functions ( Rapise allows you to do this using the special WebDriver global object:


The WebDriver object implements the various standard Selenium WebDriver API calls for automating the web browser. There is a sample available for Rapise called �UsingSelenium� that illustrates using the WebDriver code directly, but for completeness, here is a sample that uses the same web site and performs some simple actions:

//First create the Firefox driver



//Open the URL for the website:



//Find the body element and verify the text in it

var el = WebDriver.FindElementByXPath("//body");

Tester.Assert("Text found in BODY", el.GetText().indexOf("Library Information System") != -1);


//Click on the login link

var logInLink = WebDriver.FindElementById('HeadLoginView_HeadLoginStatus');



//Make sure the input textbox is as expected

var userName = WebDriver.FindElementByCssSelector("html > body > form > div:nth-of-type(3) > div:nth-of-type(2) > div:nth-of-type(2) > fieldset > p:first-of-type > input");

Tester.AssertEqual("class is 'textbox'", "textbox", userName.GetAttribute("class"));


//Go to a different URL (



//Click on the Alert box

var alertBtn = WebDriver.FindElementById("btnAlert");



//Switch to this alert box and close

var alertElement = WebDriver.SwitchToAlert();



//Shut down Selenium


When you click �Play� to playback your Selenium script, make sure you have selected one of the Selenium web browser profiles. If you have selected a native browser profile (e.g. �Firefox HTML� instead of �Selenium � Firefox�) you will get the error message �WebDriver� is not defined.


Code Completion for the Selenium WebElement Objects

When you are using functions such as FindElementsById() in your code, the returned object will be a Selenium Web Element.

If you want to have intellisense and code-completion for the returned WebElement objects, you need to do two things:

·Click on CTRL+E to include the Rapise engine in your project.

·Prefix the variable with /**WebElementWrapper*/, so instead of just:
var el = WebDriver.FindElementById(�) you use:
var /**WebElementWrapper*/el = WebDriver.FindElementById(�) instead

For example:


Interoperability with Rapise Objects

In addition to being able to use raw Selenium code on its own, you can also use a mixture of Rapise object-based code and raw Selenium WebDriver code.

For example, you are using the standard Rapise approach (using learned SeS('object') objects) for testing but at some point want to switch to Selenium API to call a couple of WebElement functions on a learned object, you can use the special �element� property:

var webElement = SeS('MyObject').element;


If you want to the reverse and be able to create a Rapise SeS('object') �on the fly� from a physical object on the web page, you can do the MakeObjectForXPath(xpath) function that returns a Rapise SeSObject, in the same way that SeS(�id�) does normally:

var sesObj = MakeObjectForXPath("//body//div[@id='logArea']");