driver.findElement(By.id("btnSendMailCopy")).click();
Thread.sleep(3000);
if(driver.findElement(By.xpath("/html/body/section[1]/div/article/nav/button[2]")).isDisplayed())
{
driver.findElement(By.xpath("/html/body/section[1]/div/article/nav/button[2]")).click();
System.out.println("clicked");
}
else if(driver.findElement(By.id("VendorCardHolderName")).isDisplayed())
{
Select dropdown = new Select(driver.findElement(By.id("VendorTinCardType")));
dropdown.selectByVisibleText("VISA");
driver.findElement(By.id("VendorCardHolderName")).sendKeys("TestName");
Without using if else i was able to run the script successfully but when I want to run else part its showing the error as
Unable to locate element: {"method":"xpath","selector":"/html/body/section[1]/div/article/nav/button[2]"}
Aucun commentaire:
Enregistrer un commentaire