Home Ask Login Register

Developers Planet

Your answer is one click away!

user2993178 February 2016

How to write xpath for a button with class attribute?

I have just started working on Selenium-Ruby . My html looks something like this-

<button class="check column btn btn-invisible">
   <i class="icon-column-p"></i>
    "Check Column"

I want to click on the button, what would be the best xpath to access it?



sunder kandasamy February 2016

You can use:

//button[@class='check column btn btn-invisible']


//button[contains(@class, 'btn')]

Jake Cobb February 2016

You can test against the text of the button with:

//button[contains(., '"Check Column"')]

Post Status

Asked in February 2016
Viewed 3,260 times
Voted 11
Answered 2 times


Leave an answer

Quote of the day: live life