availability: January 2017
I must say, Selenium is fun to play with but not really an out of the box experience. At least not the Selenium-RC part.
I've downloaded the "Selenium Remote Control 1.0 beta-1" version to try it out and created a small java app to run it directly from java.
Sample Code:
SeleniumServer server = null; DefaultSelenium browser=null; try { //create a selenium server on port 4444 and enable multiwindow support (=true); server=new SeleniumServer(4444,false,true); server.start(); //create a new browser and point it to the selenium server on 4444 //use firefox in chrome mode to use the captureEntirePageScreenShot function browser=new DefaultSelenium("localhost", 4444, "chrome", "http://www.jedi.be"); browser.start(); browser.windowMaximize();browser.setBrowserLogLevel("debug"); browser.open("http://www.jedi.be"); browser.captureEntirePageScreenshot("/tmp/snapshot.png"); } catch (Exception e) { e.printStackTrace() if(server!=null) { server.stop(); } if(browser!=null) { browser.stop() } }Firefox 2.x: mostly OK This worked ok for most of my test URL's my Firefox 2 : Build identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.17) Gecko/2008082910 Firefox/2.0.0.17.For some sites it would print out an error saying:
//5:48:53.018 INFO - Got result: ERROR: Selenium failure. Please report to the Selenium Users forum at http://forums.openqa.org, with error details from the log window. The error message is: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMCanvasRenderingContext2D.drawWindow] on session 6f08be65c1ec452b851337adda9590bbIt would this on simple pages and would often keep doing this for the next pages as well. The way the screens are captured is that selenium makes use of the canvas element and tries to make a image out of it using the drawWindow command.
Preparing Firefox profile...It turns out that the plugins Selenium puts in to the default profile it creates, still contain the maxVersion of 2.x. I followed the procedure on http://www.spacevatican.org/2008/9/27/selenium-and-firefox-3 and updated the install.rdf files within the selenium-server.jar and this would launch my firefox3 happily.
returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMCanvasRenderingContext2D.drawWindow] on session 6f08be65c1ec452b851337adda9590bbBut I still had another browser on my Macbook, on to Safari...
cp: /Library/Preferences/SystemConfiguration/preferences.plist.old: Permission deniedThis file is not present, but Selenium is trying to make a backup of the network preferences using the network-setup command. It seems if this ever fails the preferences file can become corrupt.
# diskutil repairPermissions / Started verify/repair permissions on disk disk0s2 Macintosh HD [ | 0%..10%..20%......................................... ]And this would help, as for now.
error(1224061648997): Couldn't open app window; is the pop-up blocker enabled?So I opened the Safari and changed the preference to allow pop-ups. And this got me further.
Undefined value on session 7b5337cdfcb842f3a69cdfdf3a8cb591It showed that maybe because I was test driving URL's outside my initial domain www.jedi.be, this would only be possible with chrome , iehta or running in proxy injection mode.
server.setProxyInjectionMode(true);But it would complain about:
WARN - no transformation seen for key @SESSION_ID@This seems to be a bug in the 1.0-beta-1 . And there is a fix: I'll stil have to figure this out....