Background info of my question:
I am working in FitNesse, and usually I can use CSS selectors to find and verify the elements I want. However, in this case I need to check a @title
attribute through XPath, and I'm having trouble doing so.
My FitNesse scenario is something like this:
| ensure | do | verifyText | on | !-xpath statement to the @title attribute here-! | with | @the_title_I_expect
This means that I need to find an XPath to the @title element to verify it, not have the @title with content in my XPath expression.
Can someone help me out?
Example:
<th id="scollTable.titleRow.column2" title="**This is my title**" colspan="1" scope="col" class="detailTableHeader">Some text here I don't care about</th>
I would like to check the text 'This is my title' for validity. Any pointers? Thanks in advance!
You are using Xebium? I believe they have (actually the Selenium 1 API they use has) a command verifyAttribute
that you can use to check attributes instead of the text of the element. (A quick google gave me this example page.)
So I believe your row would become:
| ensure | do | verifyAttribute | on | xpath=//th[@id='scollTable.titleRow.column2']@title| with | !-**This is my title**-!|
P.S. I'm not very familiar with Xebium but I believe you can rewrite such a line to a check
instead of an ensure
so that your test report will show you the actual title when the test fails, instead of just reporting 'failed'.