How to launch Selenium htmlSuite on a distant RC server?
We have a huge amount of htmlsuite deisgned by business analyst and we want to launch them during continuous integration (or every night) automatically. The problem is that the machine with selenium-RC is not the same one than the continuous i开发者_如何学Gontegration :
In java, we used the client-driver and it works fine :
selenium = new DefaultSelenium(serverAddress, SERVER_PORT, browser, url);
selenium.start();
and then selenium.click(..) etc ..
If I use a seleniumServer that I created and launched in java, I can launch HTMLSuite, it works fine too :
RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setPort(SelHelper.SERVER_PORT);
seleniumServer = new SeleniumServer(rcc);
seleniumServer.start();
HTMLLauncher launcher = new HTMLLauncher(seleniumServer);
If I launch a selenium server independantly (e.g. distant server) and I try to use the htmlLauncher, I does not because it takes as an argument a SeleniumServer that I can not access...
Anyone has a solution ?
The plan B would be to launch in SSH from continuous integration a .cmd file on selenium RC machine containing something like :
java -jar "X:\01_Robot\SELENIUM_RC\selenium-server-1.0.1\selenium-server.jar" -htmlSuite "*firefox" "http://www.myapplication.com" "X:\mytestsuite.html"
But it would be ugly and I want to do that only if I don't have any choice.
I finally found a "HtmlClientDriver" (similar to javaClientDriver) on : https://github.com/takamori/selenium-html-client-driver/wiki which parse html selenese and launch commands on a rc server.
I have implemented an example of a remote webdriver grid configuration in this project on Github here. You might be able to glean some good info from it. See the two .bat scripts "startWebDriverGridHub.bat" and "startWebDriverGridNode.bat". Run the former on your local machine where you are developing (or on your Jenkins server) and run the latter on the remote machine.
I wouldn't recommend starting the grid the way that you have done it, although it is doable, I would say its beyond the scope of a simple Stack question.
Also, don't use HtmlClientDriver. If you want headless, look at PhantomJS driver. If your real intention is to drive a browser on the remote computers desktop, I would use "RemoteWebDriver" in the form of Firefox driver, Chrome, or IE driver, via the scripts I provided above.
精彩评论