1

Can any one help me how I can click on button HTML

<div class="row">
<div class="span16">
<div class="pull-right">
<a class="btn primary" href="/v2/admin/user/edit" style="background-color: rgb(54, 67, 149);">Create</a>
</div>
</div>
</div>

I want to click on Create button using web driver JAVA

Rachel Gallen
  • 27,943
  • 21
  • 72
  • 81
  • duplicate of http://stackoverflow.com/questions/11947832/how-to-click-a-button-in-webdriver-using-javascript – JNDPNT Jan 22 '13 at 07:56

1 Answers1

1

If you are using selenium, you can use css seletor as jQuery do. Try:

driver.findElement(By.cssSelector("btn:contains('Create')")).click();
andyf
  • 3,262
  • 3
  • 23
  • 37
  • not working it shows following error Exception in thread "main" org.openqa.selenium.WebDriverException: An invalid or illegal string was specified Command duration or timeout: 9 milliseconds Build info: version: '2.28.0', revision: '18309', time: '2012-12-11 20:21:45' at Shingo.main(Shingo.java:148) Caused by: – user1855680 Jan 22 '13 at 09:21