Archive

Archive for August, 2012

get number of links in a page using Selenium IDE

get number of links in a page using Selenium IDE
<tr>
<td>open</td>
<td></td>
</tr>
<tr>
<td>storeEval</td>
<td>window.document.getElementsByTagName(&quot;a&quot;).length</td>
<td>totallinks</td>
</tr>
<tr>
<td>echo</td>
<td>${totallinks}</td>
<td></td>
</tr>
Advertisements
Categories: Selenium Tags:

round off the decimal value to decimal places using Selenium IDE

round off the decimal value to decimal places using Selenium IDE

Input:-

<tr>
<td>roundUp</td>
<td>23.33345555,4</td>
<td>aa</td>
</tr>
script:-
Selenium.prototype.doRoundUp = function(elementOne, elementTwo)
{
 var val = elementOne.split(‘,’);
 var value = val[0];
 var digits = val[1];
 var numberRounded = (Math.round((value*Math.pow(10,digits)).toFixed(digits-1))/Math.pow(10,digits)).toFixed(digits);
 storedVars[ elementTwo ] = numberRounded;
};
Output:-
23.3335

 

Categories: Selenium Tags: ,