I am using TestNG with ant to run Selenium scripts.
Selenium jars are located 2 directories down below ant build file.
My ant build file location: \perforce\WebEng\monthly\javaweb
Selenium jars location: \perforce\WebEng\monthly\javaweb\qa_test\lib
If I start selenium server manually and run TestNG+ant script, "ieahta" works fine.
However, selenium.start() in "iehta" mode fails when I start server programmaticaly from within TestNG+ant script.
Exception:
[testng] Starting browser...
[testng] GET: cmd=getNewBrowserSession&1=*iehta&2=http%3A%2F%2Fqa.test.com%2FLogin
[testng] overriding browser mode w/ forced browser mode setting: *iehta
[testng] Aug 28, 2007 1:29:19 PM org.mortbay.http.HttpConnection exception
[testng] WARNING: GET /selenium-server/driver/?cmd=getNewBrowserSession&1=*iehta&2=http%3A%2F%2Fqa.test.com%2FLog
n HTTP/1.1
[testng] java.lang.RuntimeException: java.io.FileNotFoundException: C:\DOCUME~1\qa\LOCALS~1\Temp\customProfileD
r959482\core\RemoteRunner.html (The system cannot find the file specified)
[testng] at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.createHTAFiles(HTABrowserLauncher.java
87)
[testng] at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.launch(HTABrowserLauncher.java:56)
[testng] at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.launchRemoteSession(HTABrowserLauncher
java:114)
[testng] at org.openqa.selenium.server.SeleniumDriverResourceHandler.getNewBrowserSession(SeleniumDriverResourceH
ndler.java:470)
[testng] at org.openqa.selenium.server.SeleniumDriverResourceHandler.doCommand(SeleniumDriverResourceHandler.java
316)
[testng] at org.openqa.selenium.server.SeleniumDriverResourceHandler.handleCommandRequest(SeleniumDriverResourceH
ndler.java:296)
[testng] at org.openqa.selenium.server.SeleniumDriverResourceHandler.handle(SeleniumDriverResourceHandler.java:12
)
[testng] at org.mortbay.http.HttpContext.handle(HttpContext.java:1530)
[testng] at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)
[testng] at org.mortbay.http.HttpServer.service(HttpServer.java:909)
[testng] at org.mortbay.http.HttpConnection.service(HttpConnection.java:816)
[testng] at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:982)
[testng] at org.mortbay.http.HttpConnection.handle(HttpConnection.java:833)
[testng] at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)
[testng] at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:357)
[testng] at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)
[testng] Caused by: java.io.FileNotFoundException: C:\DOCUME~1\qa\LOCALS~1\Temp\customProfileDir959482\core\RemoteRunner.html (The system cannot find the file specified)
[testng] at java.io.FileInputStream.open(Native Method)
[testng] at java.io.FileInputStream.<init>(FileInputStream.java:106)
[testng] at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:630)
[testng] at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:477)
[testng] at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:442)
[testng] at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:410)
[testng] at org.apache.tools.ant.util.FileUtils.copyFile(FileUtils.java:347)
[testng] at org.openqa.selenium.server.browserlaunchers.HTABrowserLauncher.createHTAFiles(HTABrowserLauncher.java
85)
[testng] ... 15 more
[testng] SERVER MODE2:*iehta
Exmple of my code:
SeleniumServer server = new SeleniumServer(4444);
server.start();
sleep(10000);
SeleniumServer.setForcedBrowserMode("*iehta");
QAReporter.log("CREATING BROWSER SESSION (executed browserSession = new DefauttSelenium(localhost,4444, *iehta,()...");
DefaultSelenium browserSession = new DefaultSelenium("localhost",4444, "*iehta","
http://qa.test.com/Login");
sleep(10000);
QAReporter.log("BROWSER STARTUP (executed browserSession.start())...");
browserSession.start();
sleep(10000);
QAReporter.log("SERVER MODE2:"+SeleniumServer.getForcedBrowserMode());