Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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 ?

share|improve this question
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
add comment

2 Answers

up vote 0 down vote accepted

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.

share|improve this answer
    
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
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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