About Me

My photo
I Love Bugs! Yum! Yum!

Wednesday, January 19, 2011

Selenium tips and tricks


Checking if a link is present by it’s href
verifyElementPresent
//a[@href="${itemlink}"]
displayAlert or echo
1. Cut and paste the following code to the end of C:\Selenium\selenium-core-0.8.2\core\scripts\user-extensions.js file
P.S. works on both IDE and TestRunner
//This extension adds command 'alert' that pops-up a alert message with a given parameter.This helps a lot in script debuging
Selenium.prototype.doDisplayAlert = function(value, varName) {
alert(value);
};

P.S. Echo works only on TestRunner
To see “echo” results in TestRunner - While running using TestRunner. Open the Log window just before you run the test suite and select the “Info” option. If you have “echo” commands it will show the information there.

No comments:

Post a Comment