Webdriver trying to click on button but receiving 'server did not provide a static trace'?
The button which im trying to click:
I have created the following method listed below, for example 96 builds would pass but then i would get 4 which would fail due to the indicated exception:
public void clickOnBuyNowButton() throws InterruptedException {
WebElement buyNowButton = driver.findElement(By.xpath("(//input[@value='Buy Now' and @value='Buy Now'])[2]"));
boolean clicked = false;
int attempts = 0;
while (!clicked && attempts < 5000) {
try {
Thread.sleep(2000);
this.wait.until(ExpectedConditions.elementToBeClickable(buyNowButton)).isEnabled();
actionMoveAndClick(buyNowButton);
clicked = true;
} catch (Exception e) {
System.out.println("Unable click on 'BuyNow' button | clickOnBuyNowButton()");
Assert.fail("Method failed: waitAndClickElement");
}
attempts++;
}
}
Thanks for your help
