I use a test setup with Webdriver and TestNG in Eclipse using java client. Earlier when i was using Selenium 1 in this same setup, it was giving a very descriptive line by line run-info which made it very easy to trouble shoot. Is there any way to get this activated in webdriver ?

  • 1
    I have yet to figure this out. For now, I just debug by throwing a new SeleniumException(messageString) – MacGyver Jan 22 '12 at 2:44

The easiest way is using WebDriverEventListener together with EventFiringWebDriver.

LogDriver listener = new LogDriver();
driver = new EventFiringWebDriver(new FirefoxDriver(profile)).register(listener);

where LogDriver should be your own class implementing WebDriverEventListener.

WebDriverEventListener methods are fired every time you use WebDriver action like findElement or click. Therefore you can put there a couple of System.out.printlns() (or something more sophisticated like appending to html file) and it should be enough for troubleshooting.

  • thanks i will try that out, for the time being, I am using a combination of both exception handlers with print stacktrace for debugging if anything fails – Rakesh Prabhakaran Jul 27 '12 at 4:29

If you run the webdriver in remotewebdriver mode, you should be able to see these commands in the node terminal. Hub will be sending these commands to node terminal. Its not the best way, but works.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.