ali haider
ali haider

Reputation: 20192

need to click on a button with selenium

I need to click on a button using selenium (java server) - the button only has a type and no id/value. Any helpful suggestions would be most welcome

<button type="submit">Enter</button>

Upvotes: 0

Views: 1139

Answers (2)

niharika_neo
niharika_neo

Reputation: 8531

Another option is //button[contains(text(),'Enter')], though this would break if you have localized sites..

Upvotes: 1

ali haider
ali haider

Reputation: 20192

The following worked for me:

selenium.click("//button[@type='submit']"

Upvotes: 0

Related Questions