how to click the post button for the following ?

<input class="k-button" type="button" style="width:90px;font-weight:bold;font-size:13px" onclick="Post();" value="Post">

1 Answer 1


You have the following options:

driver.findElement(By.className="k-button").click(); // Do not work if you have several HTML elements with the k-button CSS class on the same page
driver.findElement(By.xpath("//input[@onclick='Post();']")).click; //Do not work if you have several HTML elements with this onlick action on the same page
driver.findElement(By.xpath("//input[@value='Post']")).click; // Do not work if you have a multy language web app

But I do not know the complete HTML code, so I cannot say if this unique locators are. If not, XPath and the and operator or the index of the found elements should help.

Your Answer

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

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