- venkatkoritala
- Posts : 6
Join date : 2012-11-22
i faced a problem during running the code in selenium rc please solve it
Thu Dec 13, 2012 3:59 pm
if i run this code only one time the prestashop app store item added into cart and error occured like
Exception in thread "main" java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at nonRep.testUntitled(nonRep.java:47)
at nonRep.main(nonRep.java:70)
please solve the prob
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.SeleneseTestCase;
public class nonRep extends SeleneseTestCase {
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "https://www.google.co.in/");
selenium.start();
selenium.windowMaximize();
}
public void testUntitled() throws Exception {
selenium.open("http://localhost/prestashop/index.php");
selenium.click("css=a[title="Now that you can buy movies from the iTunes Store and sync them to your iPod, the whole world is your theater."]");
selenium.waitForPageToLoad("60000");
String text=selenium.getText("//*[@id='center_column']/div[2]");
String[] temp=text.split(" ");
int n2=Integer.parseInt(temp[2]);
System.out.println(n2);
Number n=(selenium.getXpathCount("//input[starts-with(@id,'comparator_item')]"));
System.out.println(n);
int i;
for (i=1;i<=n2;i++)
{
selenium.click("//*[@id='categories_block_left']/div/ul/li[1]/a");
selenium.waitForPageToLoad("60000");
String s="//*[@id='product_list']/li["+i+"]/div[2]/a/img";
System.out.println(s);
selenium.click(s);
selenium.waitForPageToLoad("60000");
if(selenium.isElementPresent("//*[@id='add_to_cart']/input")) //finds the button
{
selenium.focus("//*[@id='add_to_cart']/input"); // focuses the button
selenium.highlight("//*[@id='add_to_cart']/input"); //highlights the button
selenium.click("//*[@id='add_to_cart']/input"); //doesn't click the button???
selenium.wait();
}
}
}
public void tearDown() throws Exception {
}
public static void main(String[]x)throws Exception
{
nonRep r=new nonRep();
r.setUp();
r.testUntitled();
}
}
Exception in thread "main" java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at java.lang.Object.wait(Object.java:485)
at nonRep.testUntitled(nonRep.java:47)
at nonRep.main(nonRep.java:70)
please solve the prob
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.SeleneseTestCase;
public class nonRep extends SeleneseTestCase {
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 4444, "*firefox", "https://www.google.co.in/");
selenium.start();
selenium.windowMaximize();
}
public void testUntitled() throws Exception {
selenium.open("http://localhost/prestashop/index.php");
selenium.click("css=a[title="Now that you can buy movies from the iTunes Store and sync them to your iPod, the whole world is your theater."]");
selenium.waitForPageToLoad("60000");
String text=selenium.getText("//*[@id='center_column']/div[2]");
String[] temp=text.split(" ");
int n2=Integer.parseInt(temp[2]);
System.out.println(n2);
Number n=(selenium.getXpathCount("//input[starts-with(@id,'comparator_item')]"));
System.out.println(n);
int i;
for (i=1;i<=n2;i++)
{
selenium.click("//*[@id='categories_block_left']/div/ul/li[1]/a");
selenium.waitForPageToLoad("60000");
String s="//*[@id='product_list']/li["+i+"]/div[2]/a/img";
System.out.println(s);
selenium.click(s);
selenium.waitForPageToLoad("60000");
if(selenium.isElementPresent("//*[@id='add_to_cart']/input")) //finds the button
{
selenium.focus("//*[@id='add_to_cart']/input"); // focuses the button
selenium.highlight("//*[@id='add_to_cart']/input"); //highlights the button
selenium.click("//*[@id='add_to_cart']/input"); //doesn't click the button???
selenium.wait();
}
}
}
public void tearDown() throws Exception {
}
public static void main(String[]x)throws Exception
{
nonRep r=new nonRep();
r.setUp();
r.testUntitled();
}
}
- How to solve problem for dynamic ID changes using selenium
- [Help] Problem of running selenium Testcase[Java Junit] with Selenium RC
- Problem of running SmartGWT Selenium Testcase with selenium RC
- Selenium RC code not running
- Error message being displayed while running a code in Java (JUnit4) in selenium Rc .
Permissions in this forum:
You cannot reply to topics in this forum