Selenium IDE: Why "Element X = Y not found" message, despite successful execution of test step?

StackOverflow https://stackoverflow.com/questions/20887422

Pergunta

Why does Selenium IDE give me the following error message, even when it successfully clicks on the UI button? I've tried all the available click, clickAndWait, Pause (pictured here), options I know of.

Exact Log:
[info] Executing: |click | class=button save | |
[error] Element class=button save not found

HTML:

</tr>
<tr>
    <td>clickAndWait</td>
    <td>id=login</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>link=Add</td>
    <td></td>
</tr>
<tr>
    <td>waitForElementPresent</td>
    <td>class=icon-capability</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>link=Capability</td>
    <td></td>
</tr>
<tr>
    <td>waitForElementPresent</td>
    <td>class=btn btn-primary</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>name=name</td>
    <td>secondly</td>
</tr>
<tr>
    <td>click</td>
    <td>name=create</td>
    <td></td>
</tr>
<tr>
    <td>pause</td>
    <td></td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>class=button save</td>
    <td></td>
</tr>
</tbody></table>
</body>
</html>
Foi útil?

Solução

my guess is the selector. You are looking for *[class='button save']

If the element you are selecting is:

// doesn't match
<button id="something" class="save button"></button>

// matches
<button id="something_else" class="button save"></button>

My guess is that something dynamically is happening. Try matching on something more unique than a class. If it has an ID attribute, use that. If it doesn't have that and it has a name attribute, use that.

If it doesn't have anything to match on BUT the class, then try using CSS.

css=button.button.save
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top