The following code I've used is not clicking the button and showing the error message.
WebElement clickNextButton = webDriver.findElement(By.cssSelector("button[ng-class='btn-success']"));
clickNextButton.click();
Error message shows "no such element: Unable to locate element. {"method":"css selector","selector":"button[ng-class='btn-success']"}
I've also tried the following code segments without success:
WebElement clickNext1 = webDriver.findElement(By.cssSelector("button[ng-class='pccCTRL.pow.Page1InputsValid() ? 'btn-success' : 'btn-default'']"));
clickNext1.click();
webDriver.findElement(By.partialLinkText("Next")).click();
webDriver.findElement(By.cssSelector("button[type='button']")).click();
Here is the screenshot showing the html code segment of the button I'm trying to
Hoping to get feedback. Thank you.
Ok, I was able to solve this issue by using By.xpath
Here is the code segment that solved it:
WebElement clickNextButton = webDriver.findElement(By.xpath("//button[contains(text(),'Next')]"));
clickNextButton.click();