I am using Selenium RC with Junit.
After running following simple script i am getting timeout error.
com.thoughtworks.selenium.SeleniumException: Timed out after 30000ms
I have recorded the IDE script which work fine using IDE. When same code formatted using Junit format and tried to run through Eclipse and Junit it gives above timeout error.
package script;
import com.thoughtworks.selenium.*;
import java.util.regex.Pattern;
public class ComparePrice extends SeleneseTestCase {
public void setUp() throws Exception {
setUp("http://www.landmarkonthenet.com/", "*firefox");
}
public void testComparePrice() throws Exception {
selenium.open("http://www.landmarkonthenet.com/");
selenium.click("link=Books");
selenium.waitForPageToLoad("60000");
selenium.type("id=TopSearch", "junit");
selenium.click("css=button[type=\"submit\"]");
selenium.waitForPageToLoad("60000");
selenium.click("xpath=(//a[contains(text(),'Desc')])[2]");
selenium.waitForPageToLoad("60000");
String P1 = selenium.getText("xpath=/html/body[@id='department']/div[@id='page-body']/div[@id='main-content']/div[@id='page-content']/div[3]/div[1]/article/div[2]/p/span[1]");
System.out.println(P1);
String P2 = selenium.getText("xpath=/html/body[@id='department']/div[@id='page-body']/div[@id='main-content']/div[@id='page-content']/div[3]/div[2]/article/div[2]/p/span[2]");
System.out.println(P2);
String T3 = selenium.getEval("var A = Number(\"" + P1 + "\".substr(3).replace(/,/g,'')); var B= Number(\"" + P2 + "\".substr(3).replace(/,/g,'')); var c = false; if(A>=B) C=true; C");
System.out.println(T3);
}
}