Can anyone explain why/how in Selenium IDE, for an item I want to click on, the click
doesn't work, however using mouseOver
, mouseDown
, mouseUp
and mouseOut
on the same Target does work. I have even tried to use multiple of those above, e.g.:
waitForElementPresent
mouseDown
mouseOver
mouseDown
click
mouseOut
This managed to work for me on something else, when using click
didn't work. I also don't seem to be getting any errors and don't know what to do. Any help is appreciated.
UPDATE:
I clicked on the Find button in Selenium IDE and it highlighted the element, with all 6 of those Commands above, but it never actually clicks it when I run any of the commands or the case.
there are all sorts of implementations for click out there, some use Javascript that listen to the mouse down event, some use the mouse up or click or mouse over the div or td they implemented as a clickable element and then the JS start working and you get the click action expected,
therefor there is no one correct event you should launch, rather test them all or execute them all,
i use the following commands and it works for most elements that doesn't work with a simple 'click' command:
<tr>
<td>focus</td>
<td>//div[@class='dhtmlx_wins_btns_button dhtmlx_button_close_over_pressed']</td>
<td></td>
</tr>
<tr>
<td>mouseOver</td>
<td>//div[@class='dhtmlx_wins_btns_button dhtmlx_button_close_over_pressed']</td>
<td></td>
</tr>
<tr>
<td>mouseMoveAt</td>
<td>//div[@class='dhtmlx_wins_btns_button dhtmlx_button_close_over_pressed']</td>
<td></td>
</tr>
<tr>
<td>mouseDown</td>
<td>//div[@class='dhtmlx_wins_btns_button dhtmlx_button_close_over_pressed']</td>
<td></td>
</tr>
<tr>
<td>mouseDownAt</td>
<td>//div[@class='dhtmlx_wins_btns_button dhtmlx_button_close_over_pressed']</td>
<td></td>
</tr>
<tr>
<td>clickAt</td>
<td>//div[@class='dhtmlx_wins_btns_button dhtmlx_button_close_over_pressed']</td>
<td>0,0</td>
</tr>
you can try more events until it works, if you are still experiencing problems then make sure your element path is correct (use the selenium firefox IDE and press "Find" button while the FireBug is open and it will colorize the element and it's Html code with yellow glowing color so you can make sure the element path is correct),
another trick is to right click the element and click "Wait for Text..." and copy the path from that command to the click and other commands i stated earlier
if element that you want to click is hidden (for instance a floating layer html) then you can change its attribute display:none to display:block in the firebug (temporary) and that way you can use the rightclick trick to extract the exact path
If you record a "Selenium Builder" script on a page that has an iFrame, I don't believe the recorder will record the switchTo event even though the mouse will have no problem accessing it. So, on replay, without the Selenium switchTo, a selenium even wont be able to click the element unless you manually add a switchTo frame call.
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