質問

<tr id="media_gallery_content-image-1" class="preview">
   <td class="cell-image">blqblq</td>
   <td class="cell-label" style="background-color: rgb(255, 255, 255);">
     <input class="input-text" type="text" onchange="media_gallery_contentJsObject.updateImage('/2/0/20499-1.jpg')" onkeyup="media_gallery_contentJsObject.updateImage('/2/0/20499-1.jpg')">
   </td>

That is the HTML code. I have made the following xpath query so far:

xpath=(//tr[@id="media_gallery_content-image-1"]/td[@class="cell-label"]/input)

which gets me to the <input...> tag and I want to check whether it contains the text /2/0/20499-1.jpg. This is one of my (I think best) tries:

<tr>
    <td>verifyText</td>
    <td>xpath=(//tr[@id=&quot;media_gallery_content-image-1&quot;]/td[@class=&quot;cell-label&quot;]/input)</td>
    <td>/2/0/20499-1.jpg</td>
</tr>

I am using Selenium IDE 2.4.0 in Firefox

役に立ちましたか?

解決

If i may make a suggestion, use CSS. I think that your xpath selector might not be working because you are matching on arbitrary classes. The class might not == that during runtime.

Also, your test will not work to verify the text of an <input/>. You need to validate the value attribute.

Try this:

<tr>
    <td>verifyAttribute</td>
    <td>css=tr#media_gallery_content-image-1 input.input-text@value</td>
    <td>/2/0/20499-1.jpg</td>
</tr>

他のヒント

I don't see the text in the markup hence can not query it.

What you can try, is to get the attribute value, where the text is present and use wildcard in validation.

//tr[@id="media_gallery_content-image-1"]/td[@class="cell-label"]/input/@onchange

and

<td>*/2/0/20499-1.jpg*</td>
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top