Reputation: 119
I have the following element:
<button class="k-button k-button-icontext min-button-width" title="Add Matter (Access key + A)" onclick="addMatterToBill();return false;" accesskey="a">
<u>A</u>
dd Matter
How can I locate that element using c#? I have tried the following:
Driver.FindElement(By.Xpath("//input[@title= 'Add Matter (Access key + A)']")
and that did not work. I am not an expert at Xpath, so I better read/learn about it.
The actual text on the button is: Add Matter which is found in the above html between the <u>
.
Any help will be more welcome.
Upvotes: 5
Views: 11835
Reputation: 473803
The target element is a button
, not an input
:
//button[@title = 'Add Matter (Access key + A)']
You may also check the title
attribute with starts-with()
:
//button[starts-with(@title, 'Add Matter')]
Upvotes: 6