How to use GOtoIf and while in selenium IDE, Selenium Notes, Examples, Videos.By www.laxmiroy.blogspot.com/
Selenium IDE has some programing capacity upto some extend. There we can use If conditions and loop statements.
How to use GOtoIf and while
<tr>
<td>store</td>
<td>1</td>
<td>looptimes</td>
</tr>
<tr>
<td>while</td>
<td>storedVars.looptimes < 11</td>
<td></td>
</tr>
<tr>
<td>store</td>
<td>javascript{storedVars.looptimes++;}</td>
<td></td>
</tr>
<tr>
<td>gotoIf</td>
<td>javascript{(storedVars.looptimes==5);}</td>
<td>lbltest</td>
</tr>
<tr>
<td>open</td>
<td>http://www.yahoo.com</td>
<td></td>
</tr>
<tr>
<td>echo</td>
<td>${looptimes}</td>
<td></td>
</tr>
<tr>
<td>endWhile</td>
<td></td>
<td></td>
</tr>
<tr>
<td>label</td>
<td>lbltest</td>
<td></td>
</tr>
If your selenium IDE does not support while or if you don't have while js in your extension Please download below js and add in your extension.
Click here to download while.js
Start selenium server through eclipse
You can start selenium RC server using JAVA code in eclipse.
import com.thoughtworks.selenium.*;
import org.openqa.selenium.server.SeleniumServer;
import org.openqa.selenium.server.RemoteControlConfiguration;
public class Cartpayment extends SeleneseTestCase {
Selenium selenium;
public static final String MAX_WAIT_TIME_IN_MS="60000";
private SeleniumServer seleniumServer;
public void setUp() throws Exception {
RemoteControlConfiguration rc = new RemoteControlConfiguration();
rc.setAvoidProxy(true);
rc.setSingleWindow(true);
rc.setReuseBrowserSessions(true);
seleniumServer = new SeleniumServer(rc);
selenium = new DefaultSelenium(localhost, 4444, *firefox, "http://www.yahoo.com");
seleniumServer.start();
selenium.start();
}
No comments:
Post a Comment