My blog has moved!
You should be automatically redirected in 5 seconds. If not, visit and update your bookmarks.

Monday, 23 November 2009

selenium failed to start browser in iexplore mode when selenium server is started dynamically in code

In a previous post, i have written about how i have been starting/ stoping the selenium server dynamically. What i didnt mention was that i was not able to run my tests using Internet Explorer. I got this error

11:56:55.272 INFO - Command request: getNewBrowserSession[*iexplore, http://localhost:8080, ] on session null
11:56:55.272 INFO - creating new remote session
11:56:55.381 INFO - Allocated session 688eff769c8b4751b5fb9477bba213f3 for http://localhost:8080, launching...
11:56:55.397 ERROR - Failed to start new browser session, shutdown browser and clear all session data
java.lang.RuntimeException: C:\DOCUME~1\SAdesoga\LOCALS~1\Temp\customProfileDir688eff769c8b4751b5fb9477bba213f3\core\RemoteRunner.html (The system cannot find the file specified)
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.createHTAFiles(
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.launch(
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.launchRemoteSession(
at org.openqa.selenium.server.browserlaunchers.InternetExplorerLauncher.launchRemoteSession(
at org.openqa.selenium.server.BrowserSessionFactory.createNewRemoteSession(
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(
at org.openqa.selenium.server.BrowserSessionFactory.getNewBrowserSession(
at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(
at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(
at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(
at org.mortbay.http.HttpContext.handle(
at org.mortbay.http.HttpContext.handle(
at org.mortbay.http.HttpServer.service(
at org.mortbay.http.HttpConnection.service(
at org.mortbay.http.HttpConnection.handleNext(
at org.mortbay.http.HttpConnection.handle(
at org.mortbay.http.SocketListener.handleConnection(
at org.mortbay.util.ThreadedServer.handle(
at org.mortbay.util.ThreadPool$
Caused by: C:\DOCUME~1\SAdesoga\LOCALS~1\Temp\customProfileDir688eff769c8b4751b5fb9477bba213f3\core\RemoteRunner.html (The system cannot find the file specified)
at Method)
at Source)
at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.createHTAFiles(
... 19 more
This points out that selenium is trying to start in the iehta mode, even though i have specified that it start in iexplore mode. Doing i quick search i discovered that there has been some work to start up selenium in iehta even when iexplore is being specified. And the only way to get the original *iexplore is to try *iexploreproxy or piiexplore

So i changed my config file to start selenium using "*iexploreproxy" instead of "*iexplore" and voila i am able run my test on ie.

Hope this helps you too


daxel said...

I think this problem does not depends on Selenium Server start configuration. In my project the same code works runnning in eclipse and doesn't work starting from maven. I'm trying to understand the problem.....

leumascom said...

the only reason i have said that the problem is due to selenium server being started dynamically in code is because when i remove that bit of the code and run selenium server from a bat file, i didnt get the same problem