Thursday, November 3, 2011

In selenium RC you can use below code

In selenium RC you can use below code , Selenium Notes, Examples, Videos.By www.laxmiroy.blogspot.com/


selenium.open("http://economictimes.indiatimes.com/");

selenium.type("css=input[style='width: 120px; font-size: 12px;']", "Business");

There is another way to use css instead of Xpath

Try below code for clicking on search button on www.google.com


<tr>
<td>type</td>
<td>q</td>
<td>www.automationtricks.blogspot.com</td>
</tr>
<tr>
<td>click</td>
<td>css=span.ds > span.lsbb > input.lsb</td>
<td></td>
</tr>



When selenium.waitForPageToLoad is not working
When selenium.waitForPageToLoad() is not working the we can use alternate solution.


boolean Condition = false;
for (int second = 0; second < 60; second++) {
try {
if ((selenium.isElementPresent("xpath of your element on which you want to click"))) {

selenium.click("xpath of your element on which you want to click");
Condition = true;
break;
}
}
catch (Exception ignore) {
}
pause(1000);
}
assertTrue(Condition);

No comments:

Post a Comment