I have tried to click a button using id, then class name, then xpath, id is given dynamically. Could you please tell me the exact xpath for this code
package step_definitions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
import cucumber.api.java.en.When;
public class sharedshelf {
public WebDriver driver;
public sharedshelf()
{
driver = Hooks.driver;
}
@When("^I press option button$")
public void i_press_option_buttion() throws Throwable {
// Write code here that turns the phrase above into concrete actions
Thread.sleep(5000);
driver.findElement(By.xpath("//button[text()='Edit']")).click();
}
Html
<button type="button" id="ext-gen494" class=" x-btn-text" tabindex="4">Edit</button>