Trying Selenium IDE. I'm getting an intermittent error, I've tried slowing down the IDE but it still happens. I start w/google and search for fishbase, I then click search fishbase link - then "common name is" and I put Taron in and like the top-most "usa" link. Usually it gets error at the same place "[error] Element name=CommonName not found", 9 times out of ten it has a problem there. I hope I've provided enough info. Using Ubuntu 11.10 and FF 11.0. I have a very fast connection but move the slider to slow. Why does this problem occur?
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>id=gbqfq</td>
<td>fishbase</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>css=em</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=CommonName</td>
<td>Tarpon</td>
</tr>
<tr>
<td>clickAndWait</td>
<td>css=input[type="button"]</td>
<td></td>
</tr>
<tr>
<td>clickAndWait</td>
<td>link=Tarpon</td>
<td></td>
</tr>
It worked the 1st time but not the 2nd time...thanks.
[info] Executing: |open | / | |
[info] Executing: |type | id=gbqfq | fishbase |
[info] Executing: |clickAndWait | css=em | |
[info] Executing: |type | name=CommonName | Tarpon |
[info] Executing: |clickAndWait | css=input[type="button"] | |
[info] Executing: |clickAndWait | link=Tarpon | |
[info] Executing: |open | / | |
[info] Executing: |type | id=gbqfq | fishbase |
[info] Executing: |clickAndWait | css=em | |
[info] Executing: |type | name=CommonName | Tarpon |
[error] Element name=CommonName not found
To achieve this, we shall use the method getPageSource which gets the entire page source. So we can obtain a complete page source and check if the text of the element exists. We also use the findElements method and utilize any locators like xpath, CSS, and so on to identify the matching elements.
There are multiple ways to achieve this. We can introduce a try / except block. In the except block, we shall throw the NoSuchElementException in case the element does not exist on the page. We can also verify if an element is present in the page, with the help of find_elements() method.
This will solve your problem
<tr>
<td>click</td>
<td>css=em</td>
<td></td>
</tr>
<tr>
<td>pause</td>
<td>7000</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>name=CommonName</td>
<td>Tarpon</td>
</tr>
Or just put pause before command type| name=CommonName |Tarpon
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With