How to export webdriver code to Selenium IDE using Javascript

I am using the Selenium 2.0 IDE in Firefox to record my test cases. I wrote some JavaScript support to help make the program more dynamic.

The problem that I am facing is that whenever I try to export C # or Java Webdriver code in the test ... () section, it does not recognize my JavaScript functions. In the generated Webdriver code, it has a commented line saying something like

// ERROR: Fixed exception [unknown command [navigateDashboard]]

So, I think my first question is that it is even possible to export test cases of Selenium IDE to Webdriver code, if there is JavaScript, and the second - if so, then how?

Thank you, I searched everywhere for an answer, but I can’t find anything to confirm this.

EDITOR (In response to arranging): In the IDE, I have a command like this:

navigateDischarges | | 

"navigateDischarges" is a JavaScript function:

 Selenium.prototype.doNavigateDashboard = function() { this.browserbot.openLocation(this.getURL(dashboard)) ; } Selenium.prototype.getURL = function(input) { return (prefix + input); } 

I know this is a simple example, but I was hoping to do more complex things with it.

+4
source share
1 answer

While the doNavigateDashboard Javascript function works in the Selenium IDE, the WebDriver exporter I wrote does not know how to export the navigateDischarges command to another language, because obviously this command does not exist in the WebDriver libraries for that language.

Remember that WebDriver does not support user extensions. Therefore, you will need to find a way to code your function in your chosen language (in this case, C #). Once this is done, you can export the test case and manually add calls to your function. Sometimes the "show Selenese" formatting option is useful.

+2
source

Source: https://habr.com/ru/post/1484894/


All Articles