The xpath for clicking edit button is not working in Selenium Java



  • HTML Code:

    <button onclick="root.handleOnClick( document, this );" id="Edit_edit::0" 
    title="Edit" name="Edit_edit::0" class="navbar-btn btn btn-default btn-sm cs-btn" 
    type="button">Edit</button>
    

    XPath which I used:

    driver.findElement(By.xpath("//button[@title='Edit']")).click();
    

    Please help me to run this code.



  • Try the below code to click button.

    WebElement element=driver.findElement(By.xpath("//button[@title='Edit']"));
    JavascriptExecutor js = (JavascriptExecutor)driver;
    js.executeScript("arguments[0].click();", element);
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2