I am trying to automate a purchase on a e-commerce website (used only for training) in Selenium Webdriver using Java. When I click on Add To Cart, a popup window appears with "Continue Shopping" or "Proceed to Checkout" buttons. The problem is, Selenium is unable to detect the Checkout button. On further investigation (isDisplayed()), I found out that it is unable to detect the entire popup window.All I get is ElementNotVisibleException.
I tried below options: 1) Checked if there are multiple windowHandles and found out there is only one window handle. 2) Checked if the popup is another frame. But it is part of the main frame. So switching to another frame is also ruled out. 3) I tried scrolling down the window a little. 4) Tried using WebdriverWait to locate presence of Element.
I am not sure what I am missing here. Any help is appreciated.
Below is the exact page where I am having trouble. http://automationpractice.com/index.php?id_product=4&controller=product
Snippet of my code:
WebElement proceed_to_checkout = (new WebDriverWait(driver, 20)).until(ExpectedConditions.presenceOfElementLocated(By.xpath(".//*[@id='layer_cart']/div[1]/div[2]/div[4]/a/span"))) ;
proceed_to_checkout.click();