I am trying to perform a simple checkout flow on my staging website, but I cant seem to find the element. I tried to use selenium IDE which works but when it comes to coding in java I keep getting stuck on secure checkout
this is the element button I want to click
<a class="checkout-anchor click-button display-flex vertical-align-center justify-center" href="javascript:void(0);" onclick="onCheckout()" data-stepid="cartstep04">
<img src="https://release.squareoffnow.com/public/assets/images/checkout/svg/secure.svg" class="secure-pic ls-is-cached lazyloaded" alt="">Secure Checkout</a>
This is the code i have written so far
package googleTestCases;
import org.openqa.selenium.By;
import org.openqa.selenium.Dimension;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
public class simpleCartFlow {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","/Users/manavmehta/Desktop/squareoffSeleniumProjects/chromedriver");
WebDriver driver=new ChromeDriver();
driver.get("http://release.squareoffnow.com/");
driver.manage().window().setSize(new Dimension(1440, 789));
driver.findElement(By.linkText("Products")).click();
driver.findElement(By.cssSelector(".store-buy-pro-button")).click();
driver.findElement(By.cssSelector(".pro-twinpack-button")).click();
driver.findElement(By.cssSelector(".whole-purchase-button")).click();
driver.findElement(By.cssSelector(".productAvailability > .click-button")).click();
driver.findElement(By.cssSelector(".giftpackSubmit")).click();
System.out.println("button not clicked");
driver.findElement(By.cssSelector(".checkout-anchor")).click();
System.out.println("button clicked");
driver.quit();
}
}
instead of using a CSS selector I also tried to use linkText but it still didn't work