Export Selenium-IDE Scripts in CFSelenium (ColdFusion) Format
Posted At : February 23, 2011 10:13 AM | Posted By : Bob Silverberg
Related Categories: CFSelenium, Selenium
Hot on the heels of the release of CFSelenium, I have created a Firefox plugin that will allow you to export scripts from Selenium-IDE in CFSelenium format, wrapped inside an MXUnit test case. The plugin is dead simple to use, simply add the extension to your installation of Firefox and you'll see a new menu item in Selenium-IDE under File - Export Test Case As..., Options - Format and Options - Clipboard Format. The menu item is labelled CFML (ColdFusion) Selenium RC (MXUnit). Choosing this menu item will translate your current test case into CFSelenium format, wrapped in an MXUnit test case.
The Firefox extension is available in the distribution at both GitHub and RIAForge, and will hopefully be made available at SeleniumHQ once it's found to be stable. I'm sure it could use some improvements, so please give it a try and let me know what you think of it.
I was able to create the Firefox extension by basically copying and modifying the source code for the Grails Formatters created by Rob Fletcher, so a big thank you goes out to him for making the job simple and painless.
There was one thing I noticed initially: when I exported some existing tests to CFCs, I noticed that waitForTextPresent gets converted to a for loop, but it seems as though the for loop is coded in Java rather than CFScript (or at least I recognize the syntax from Java). The loop starts with
for( int second=0;; second++ ) {
but the int keyword is invalid there. Removing it gave me a valid script function.
At test runtime, Firefox 5 support is provided with Selenium 2.0, so I had to upgrade Selenium 1.3 to 2.0.
Also, I upgraded CFSelenium to 1.5 and found I had to change how I initialize selenium.cfc by passing the browseURL and browserStartCommand to selenium.start() instead of relying on the init().
Once both those changes were made, all my tests passed as normal with a few exceptions. It seems that some selectWindow("name=theWindowName") started failing. I attributed it to Selenium because when I swapped in Selenium 1.3 again the tests passed. So I coded in a workaround and all was good.
As far as the CFML Formatter for Firefox 5, presently I'm just recording in Firefox 3, then running my automation suite with Firefox 5.
Also for my fully automated QA server, I used the JavaService tool to install Selenium RC as a Windows Service so that I could leave it running unattended without being logged in. I followed this http://bit.ly/pWS7yR to create a custom bat file to perform the installation.
Jenkins is now running tests every day at 6am by kicking off the ANT file I created for each of our test suites. One job stops the SeleniumRC and CF Services, runs svnupdate, then restarts the servers, and begins the first test suite. SUPER happy with it!
Do you perhaps know how to mass-export hundreds of tests without going through each and every one of them?
How do i identify a pop up window opened by server?
When i click on submit button a php file validates the form and then opens pop up initiated by the server. Selenium is unable to identify the pop up, returns window doesn not exist. i have tried using different commands but unable to tackle this pop up.
I have posted in google groups but no reply. Issue is critical.
http://groups.google.com/group/selenium-users/brow...
i.e i want to driven data in selenium with the help of selenium