clickAt is not working through RobotFramework

387 views
Skip to first unread message

tmpalaniselvam

unread,
Apr 21, 2011, 7:54:45 AM4/21/11
to robotframework-users
Hi,
One of page contains few texts and needs to click the text object and
add into the list. I used Selenium IDE and ClickAt is working. The
same commands used through Robot Framework and click action is not
done on text object, but the log shows PASS for that step. I have
added keyword 'Click Element Point' by using click_at method.

HTML Source:
<td
id="ctl00xctl00xContentPlaceHolder1xplcContentsxrptrItemsxctl03xctl00xleftTabsxxctl0xctl00xLeftGrid_rc_1_1"
class="ig_17e775c7_r20 ig_17e775c7_r19 ig_17e775c7_r21"><nobr
title="">Actimel</nobr></td>

Working Selenese command in IDE:
|clickAt | //nobr[contains(text(),"Actimel")] | 10,5 |

Used steps in Robotframework:
Call Selenium API click_at xpath=//nobr[contains(text(),"Actimel")]
10,5
Call Selenium API click_at //nobr[contains(text(),"Actimel")] 10,5

${objMember}= Set Variable xpath=//nobr[contains(text(),"Actimel")]
Click Element Point ${objMember} 10,5 don't wait

RobotFramwork Result log:
KEYWORD: SeleniumLibrary.Click Element Point ${objMember}, 10,5, don't
wait
Documentation: Click element identified by `locator` on the given
relative position.
Start / End / Elapsed: 20110421 16:00:49.753 / 20110421 16:01:25.224 /
00:00:35.471
16:01:25.224 INFO Clicking element 'xpath=//
nobr[contains(text(),"Actimel")]' on relative position '10,5'

What could be the problem? What kind of tricks can be used.

Thanks,
Palani

Pekka Klärck

unread,
Apr 25, 2011, 4:27:46 PM4/25/11
to palani...@gmail.com, robotframework-users
2011/4/21 tmpalaniselvam <palani...@gmail.com>:

> Hi,
> One of page contains few texts and needs to click the text object and
> add into the list. I used Selenium IDE and ClickAt is working. The
> same commands used through Robot Framework and click action is not
> done on text object, but the log shows PASS for that step. I have
> added keyword 'Click Element Point' by using click_at method.

What action should occur after you click the element? Notice that if
there's a page load, you need to call wait_for_page_to_load yourself.

Adding new keywords to SeleniumLibrary that wrap clickAt and
doubleClickAt Selenium methods would probably be pretty simple. Please
submit an enhancement request to Selenium's tracker. There's probably
going to be SeleniumLibrary 2.6.1 soon.

Cheers,
.peke
--
Agile Tester/Developer/Consultant :: http://eliga.fi
Lead Developer of Robot Framework :: http://robotframework.org

tmpalaniselvam

unread,
Apr 26, 2011, 3:44:28 AM4/26/11
to robotframework-users
Pekka,

> What action should occur after you click the element? Notice that if
> there's a page load, you need to call wait_for_page_to_load yourself.
>
> Adding new keywords to SeleniumLibrary that wrap clickAt and
> doubleClickAt Selenium methods would probably be pretty simple. Please
> submit an enhancement request to Selenium's tracker. There's probably
> going to be SeleniumLibrary 2.6.1 soon.
>

No actions required after click action. No page load happens.

I have extended SeleniumLibrary for clickAt and doubleClickAt. But it
is not working and also tried out Call Selenium API directly... Test
results (log.html) is showing as PASS, but object is not clicked.
Similarly anybody faced the issue?. For time-being, I'm using
AutoItLibrary keywords as temporary solution.


Call Selenium API clickAt //nobr[contains(text(),"Actimel")] 10,5
Call Selenium API click_at xpath=//nobr[contains(text(),"Actimel")]
10,5
Call Selenium API click_at //nobr[contains(text(),"Actimel")] 10,5
Call Selenium API double_click_at ${objMember} 10,5


Methods added to SeleniumLibrary in click.py :
==================================
def _click_point(self, locator, coordString='0,0', dont_wait=''):
""" Added by Palani for EYC
"""
self._selenium.click_at(locator, coordString)
if not dont_wait:
self.wait_until_page_loaded()
def click_element_point(self, locator, coordString="10,5",
dont_wait=''):
"""Click element identified by `locator` on the given relative
position.

Key attributes for arbitrary elements are `id` and `name`. See
`introduction` for details about locating elements and about
meaning
of `dont_wait` argument.

'locator' is an element locator
'coordString' is specifies the x,y position (i.e. - 10,20) of
the mouse event relative to the element returned by the
locator.
"""
# Added by Palani for EYC
self._info("Clicking element '%s' on relative position '%s'" %
(locator, coordString) )
self._click_point(self._parse_locator(locator), coordString,
dont_wait)

Thanks & Regards,
Palani.
http://tips-testing.blogspot.com/index.html

Janne Härkönen

unread,
Apr 27, 2011, 3:58:02 AM4/27/11
to palani...@gmail.com, robotframework-users
Hello Palani,

On Tue, Apr 26, 2011 at 10:44 AM, tmpalaniselvam
<palani...@gmail.com> wrote:
> I have extended SeleniumLibrary for clickAt and doubleClickAt. But it
> is not working and also tried out Call Selenium API directly... Test
> results (log.html) is showing as PASS, but object is not clicked.
> Similarly anybody faced the issue?. For time-being, I'm using
> AutoItLibrary keywords as temporary solution.
>
>
> Call Selenium API       clickAt //nobr[contains(text(),"Actimel")]      10,5
> Call Selenium API       click_at        xpath=//nobr[contains(text(),"Actimel")]
> 10,5
> Call Selenium API       click_at        //nobr[contains(text(),"Actimel")]      10,5
> Call Selenium API       double_click_at ${objMember}    10,5
>

The fact that the test pass means that the component is found and the
selenium method gets successfully executed, so this seems a bit weird.

What is the expected result of clicking the element? Have you tested
this with different browsers?


--J

--
Janne Härkönen | http://reaktor.fi
http://twitter.com/#!/janneharkonen

tmpalaniselvam

unread,
Apr 27, 2011, 6:32:35 AM4/27/11
to robotframework-users
Hi Janne,

> The fact that the test pass means that the component is found and the
> selenium method gets successfully executed, so this seems a bit weird.
>
> What is the expected result of clicking the element? Have you tested
> this with different browsers?

Expected behavior is to select the text. I tried robotframework
execution on IE only and did not check on Firefox.

Pekka Klärck

unread,
Apr 27, 2011, 7:08:27 AM4/27/11
to palani...@gmail.com, robotframework-users
2011/4/27 tmpalaniselvam <palani...@gmail.com>:

>
>> The fact that the test pass means that the component is found and the
>> selenium method gets successfully executed, so this seems a bit weird.
>>
>> What is the expected result of clicking the element? Have you tested
>> this with different browsers?
>
> Expected behavior is to select the text. I tried robotframework
> execution on IE only and did not check on Firefox.

Could you test with Firefox? You mentioned earlier that this works
with Selenium IDE which, if I remember correctly, works on with
Firefox and I wouldn't be surprised if it would work there also with
SeleniumLibrary.

tmpalaniselvam

unread,
Apr 27, 2011, 10:01:30 AM4/27/11
to robotframework-users
Hi Pekka,

> Could you test with Firefox? You mentioned earlier that this works
> with Selenium IDE which, if I remember correctly, works on with
> Firefox and I wouldn't be surprised if it would work there also with
> SeleniumLibrary.

Script is working in Firefox.. The same script is working on Windows7
+ IE8 and it is not working for WinXP + IE8. Looks like machine
dependency..

Pekka Klärck

unread,
Apr 29, 2011, 10:58:53 AM4/29/11
to palani...@gmail.com, robotframework-users
2011/4/27 tmpalaniselvam <palani...@gmail.com>:

>> Could you test with Firefox? You mentioned earlier that this works
>> with Selenium IDE which, if I remember correctly, works on with
>> Firefox and I wouldn't be surprised if it would work there also with
>> SeleniumLibrary.
>
> Script is working in Firefox.. The same script is working on Windows7
> + IE8 and it is not working for WinXP + IE8. Looks like machine
> dependency..

Ok. This sounds like a Selenium or environment related issue that we
cannot do anything in SeleniumLibrary.

Notice that SeleniumLibrary now supports clickAt. Instead of adding a
new keyword we changed existing Click Element so that it takes
optional coordinates as an argument. We'll also add Double Click
Element keyword. The release will most likely be ready on Monday.

Reply all
Reply to author
Forward
0 new messages