RE: Unable to click Add to Cart Button in this demo site “http://store.demoqa.com/products-page/product-category/ipads/”

Hi,
When I try to click add to cart button , I am getting an exception as org.openqa.selenium.WebDriverException: unknown error: Element is not clickable at point (1087, 646). Other element would receive the click: <div class=”pp_middle”></div>”.

  Link :
http://store.demoqa.com/products-page/product-category/ipads/

I tried with all the options. Kindly refer my code given below:

//Mouse Hover actions
Actions a=new Actions(driver);
WebElement element1=driver.findElement(By.xpath(“.//*[@id=’menu-item-33′]/a”));
a.moveToElement(element1).build().perform();

driver.findElement(By.linkText(“iPads”)).click();
String handle1=driver.getWindowHandle();
driver.switchTo().window(handle1);
System.out.println(driver.getCurrentUrl()+ ” Current URL \n Window handle:”+handle1);
WebElement element2=driver.findElement(By.className(“product_image”));
element2.click();

String handle2=driver.getWindowHandle();
driver.switchTo().window(handle2);
driver.findElement(By.linkText(“Close”)).click();

//driver.switchTo().defaultContent();
// String handle5=driver.getWindowHandle();
// driver.switchTo().window(handle5);
driver.switchTo().window(handle1);
driver.findElement(By.xpath(“.//*[@id=’default_products_page_container’]/div[3]/div[2]/form/div[2]/div[1]/span/input”)).click();

ChamuKR Default Asked on February 15, 2016 in Selenium WebDriver.
Add Comment
3 Answers

xpath is working fine,
other add to cart button have different div
/html/body/div[2]/div/div/div/div/div[1]/article/div/div/div[5]/div[2]/form/div[2]/div[1]/span/input

Train Answered on March 10, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.