Run Selenium IDE Script in Different Browsers using WebDriver Playback
WebDriver Playback is a newly introduced feature in Selenium IDE. It allows users to run Selenium IDE tests in multiple browsers. Thus increasing usefulness of Selenium IDE as test automation tool. This article explains how we can use WebDriver Playback feature and run our Selenium IDE script in different browsers other than Mozilla Firefox.
We will try to run a Selenium IDE test script on Google Chrome browser. Of course, you can run your test on other browsers such as Internet Explorer, Opera, Android, iPhone, iPad etc. For that, you’ll just have to replace the browser name in WebDriver Playback tab. We’ll see this in our example steps. For now, let’s follow below steps to run Selenium IDE script on Google Chrome.
- Open Selenium IDE.
- Go to Options–>Options–>WebDriver tab.
- Check the option to ‘Enable WebDriver Playback’ from opened tab.
- Provide ‘chrome’ value in text box and click OK button. We can specify browser name of our choice in the text box. Browser names are given in ‘Browser choices’ text displayed below this text box. Your options dialog should look similar to below image after making these changes.
- Restart Selenium IDE. Restart is required for the changes to take effect.
- We will need respective browser driver(in our case, Chrome driver) along with Selenium Standalone JAR file. You can download them from here and here. Once you have these files, place both of them in same folder.
- Now open your Command Prompt and navigate to the directory where driver and JAR files are stored.
- Run following command from Command Prompt to start Selenium server and Chrome Driver server. Use respective driver name if you are using a different browser.
1java -jar selenium-server-standalone-2.43.1.jar -Dwebdriver.chrome.driver=chromedriver.exe - Now, open your Selenium IDE script and run it as you usually do.
- You should see your test script getting executed in Google Chrome browser.
Please note that the browser will remain open after test script is executed. You will have to manually close it.
As seen from the above example, we can use WebDriver Playback to easily run our Selenium IDE tests in browsers other than Firefox. This feature adds more flexibility in Selenium IDE which can be of great use to all Selenium users. We hope you would find the WebDriver Playback feature useful. Let us know in comments how it goes for you.
Which locater can be used , for me x-path is only While launched with chrome.
Well, it’s strange. I was able to use XPath locator with IE browser. I am using IE 10 and Selenium IDE 2.8.0.
Hi, I needed help please. It seems it’s not working for me, I tried exactly same steps as mentioned and on Command prompt I got this error:
Error: Unable to access jarfile selenium-server-standalone-2.45.0.jar
My file is located here: C:\Users\drandhawa\Desktop\SeleniumTraining\Selenium Server
So, what do I type in command prompt if this is the case?
I have used gotoif using “sideflow.js”. It’s causing my chrome playback to fail. Do you have any suggestion to handle this? Also will you please explain how I can use this test for ipad?
i am using linux. and m getting 18:30:31.381 WARN – Failed to start: SocketListener0@0.0.0.0:4444
Exception in thread “main” java.net.BindException: Selenium is already running on port 4444. Or some other service is.
at org.openqa.selenium.server.SeleniumServer.start(SeleniumServer.java:492)
at org.openqa.selenium.server.SeleniumServer.boot(SeleniumServer.java:305)
at org.openqa.selenium.server.SeleniumServer.main(SeleniumServer.java:245)
at org.openqa.grid.selenium.GridLauncher.main(GridLauncher.java:64)
Look for process that’s already using the default port 4444 and kill it. Restart Selenium.
I tried to run Selenium Server and this is the error Im getting. I dont know why this error is coming, please help!
C:\selenium>java -jar selenium-server-standalone-3.4.0.jar
06:09:55.596 INFO – Selenium build info: version: ‘3.4.0’, revision: ‘unknown’
06:09:55.597 INFO – Launching a standalone Selenium Server
2017-06-22 06:09:55.629:INFO::main: Logging initialized @607ms to org.seleniumhq.jetty9.util.log.StdErrLog
06:09:55.698 INFO – Driver class not found: com.opera.core.systems.OperaDriver
06:09:55.699 INFO – Driver provider com.opera.core.systems.OperaDriver registration is skipped:
Unable to create new instances on this machine.
06:09:55.701 INFO – Driver class not found: com.opera.core.systems.OperaDriver
06:09:55.701 INFO – Driver provider com.opera.core.systems.OperaDriver is not registered
06:09:55.704 INFO – Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN10
2017-06-22 06:09:55.766:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-06-22 06:09:55.831:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@1d057a39{/,null,AVAILABLE}
Usage: [options]
Options:
–version, -version
Displays the version and exits.
Default: false
-browserTimeout
in seconds : number of seconds a browser session is allowed to
hang while a WebDriver command is running (example: driver.get(url)). If the
timeout is reached while a WebDriver command is still processing, the session
will quit. Minimum value is 60. An unspecified, zero, or negative value means
wait indefinitely.
Default: 0
-debug
: enables LogLevel.FINE.
Default: false
-jettyThreads, -jettyMaxThreads
: max number of threads for Jetty. An unspecified, zero, or
negative value means the Jetty default value (200) will be used.
-log
filename : the filename to use for logging. If omitted, will log
to STDOUT
-port
: the port number the server will use.
Default: 4444
-role
options are [hub], [node], or [standalone].
Default: standalone
-timeout, -sessionTimeout
in seconds : Specifies the timeout before the server
automatically kills a session that hasn’t had any activity in the last X seconds. The
test slot will then be released for another test to use. This is typically
used to take care of client crashes. For grid hub/node roles, cleanUpCycle
must also be set.
Default: 1800
java.lang.RuntimeException: java.net.BindException: Address already in use: bind
at org.openqa.selenium.remote.server.SeleniumServer.boot(SeleniumServer.java:149)
at org.openqa.grid.selenium.GridLauncherV3$1.launch(GridLauncherV3.java:238)
at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:99)
Caused by: java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:433)
at sun.nio.ch.Net.bind(Net.java:425)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.seleniumhq.jetty9.server.ServerConnector.open(ServerConnector.java:298)
at org.seleniumhq.jetty9.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.seleniumhq.jetty9.server.ServerConnector.doStart(ServerConnector.java:236)
at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.seleniumhq.jetty9.server.Server.doStart(Server.java:431)
at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.openqa.selenium.remote.server.SeleniumServer.boot(SeleniumServer.java:147)
… 2 more
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: ‘2.46.0’, revision: ’87c69e2′, time: ‘2015-06-04 16:16:47’
System info: host: ‘goofy’, ip: ‘127.0.1.1’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘4.4.0-83-generic’, java.version: ‘1.8.0_131’
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:192)