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" 

XPath which I used:


Please help me to run this code.

  • use javascriptexecutor to click the button
    – Vel Guru
    Oct 17, 2018 at 6:23
  • You say you have the frames. Tell us what is the frame structure that holds your button? Is there just a frame that holds your button or frame that contains another frame that holds your button? Also show us frame html elements.
    – Alexey R.
    Oct 17, 2018 at 9:25
  • Your question is not clear and lacks essential details necessary to provide an good answer sqa.stackexchange.com/help/how-to-ask Oct 17, 2018 at 14:41

2 Answers 2


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);
  • Thanks for your code.I tried it,but its not working.There is frames,forms in my working site.Whether we have to first write code for frames,forms. Oct 17, 2018 at 9:15

If there is a frame in the page you need to switch into the frame first and then you can access the button by using your xpath.

To switch into the frame use below command

driver.switchTo().Frame(id or class); 

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.