I am trying to click a button through webdriver. After inspecting the button element it highlights to the following:
XPath:
/html/body/div/div/main/div/div[2]/div/div[2]/table/tbody/tr/td[4]/form/button
This is my code:
WebDriver driver= new FirefoxDriver(); driver.get("Website link");
driver.findElement(By.id("email")).sendKeys("xyz");
driver.findElement(By.id("password")).sendKeys("xyz");
driver.findElement(By.xpath("//*[text()='Log in']")).click();
driver.findElement(By.xpath("//button[text()='CANCEL']")).click();
But, when I try to run the code, it doesn't click the button. Can anyone help me solve this? Would be a great help