It’s here! It’s finally here! I have finally committed the code for the WebDriver playback feature in Selenium IDE. If you have not seen the video of the demo during Selenium Conference 2012, you can watch it here. Someone pointed out that it has become the most popular video from the conference :D.
I will try to do the official Selenium IDE 2.0 release in a week or two, once I figure out the new CI infrastructure. For those who cannot wait till then, it is available for a short time from my GitHub repository.
For a long time, even I believed that webdriver integration in Selenium IDE could not be done. I may post how it came to be some time in the future. Do not forget that this is still a highly experimental feature and proceed with utmost care. Backup all your important stuff, anything may happen. Backing up your important stuff is always a useful step under any circumstances :). Let us know how it goes and we will try to fix any issues that you may face. Don’t forget to tell us if it works for you as well. We always appreciate feedback, especially now, as we are discussing the phasing out of Selenium IDE.
Ready your environment
Once you have the new version of Selenium IDE, there is still some work to be done before you can use it. I will try to simplify and automate whatever I can in the future. I have a separate post for each of the following three steps to get your environment set up correctly.
Start the Selenium Server
Once you change to the folder where you have downloaded and extracted the Selenium Server, you can start the Selenium Server with the following command line on Windows.
java -jar selenium-server-standalone-2.28.0.jar -Dwebdriver.ie.driver=.\IEDriverServer32.exe
For Linux and Max OS, you can skip the Internet Explorer Driver portion and simply start the Selenium Server with the following command line.
java -jar selenium-server-standalone-2.28.0.jar
Potential Problems starting Selenium Server
Based on your system settings, you may have to deal with a Firewall prompt and may have to set the Zoom level.
Set the WebDriver Playback Settings in Selenium IDE
By default, WebDriver playback is turned off so recording and playback will work as before. To experiment with the WebDriver playback, you need to explicitly turn it on through the WebDriver tab of the Options dialog. To turn on WebDriver playback, check the option Enable WebDriver Playback.
Then set the Browser to the one you want to use. The choices are android, chrome, firefox, htmlunit, internet explorer, iPhone, iPad and opera.
Finally restart the Selenium IDE. A restart is required to enable or disable WebDriver Playback. Changing the browser does not require a restart.
So how does it work?
Every command that is executed, is caught and sent to the Selenium Server and executed using WebDriver instead of being executed locally and the response from WebDriver is used as the result. For most commands, the Selenium Emulation layer inside the Selenium Server is used. The newly introduced SendKeys command is not emulated, but is directly executed using the WebDriver JSON wire protocol. For most users, it really should not matter how the whole thing works, except that it works. Keep in mind that there are some commands and some arguments that are yet to be supported.
This is merely the first step in providing full WebDriver playback. Bugs and limitations are to be expected. I am aware of the following limitations:-
- Multiple browser windows will be opened and will remain open.
- Test may not pause or exit on errors.
- An alert message may pop up for conditions that I have not encountered in my testing.
- Executing a single command is not yet supported.
- Highlighting a locator using the Find button may not work.
- The timeout settings are ignored.
- Screenshots may not work.
- User extensions and plugins may not work.
As you probably know by now, I do not use Selenium IDE myself, so I can only test it a tiny bit. Your help in reporting any issues is always most appreciated.
I am planning to finish the following improvements in the future.
- Support for screenshots.
- Individual execution of commands.
- Use timeouts as specified in options.
- Automatic download and starting of Selenium Server and Internet Explorer Driver.
- Highlighting elements.
- A option to close the browser windows or leave it open
When that actually happens will depend on the feedback I get from you all and the time I am able to spare to work on it.