I'm confuse with the difference between 'Click' & 'ClickAt' command in selenium. & need to know where i can use 'ClickAt' command ?
Hi,
Here are what Selenium IDE says about those two commands :
click(locator)
Arguments:
- locator : an element locator
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call waitForPageToLoad.
And :
clickAt(locator, coordString)
Arguments:
- locator : an element locator
- coordString : specifies the x,y position (i.e. - 10,20) of the mouse event relative to the element returned by the locator.
Clicks on a link, button, checkbox or radio button. If the click action causes a new page to load (like a link usually does), call waitForPageToLoad.
click
is used when you just want to "click" on an element, like a button, a link, ...
And clickAt
is used when you want to "click" on a position designated by mouse coordinates.
I suppose the second one can be useful for some "rich" applications -- I've actually never used it... On the other hand, I use click
like all the time.
If you have a page with form elements, links, buttons, and stuff like that, you'll probably generally use click
: it's way easier to find an element using it's id or classname than having to find it's position in pixels on the page ^^
I'm testing a GWT application and it seems like I have to use clickAt if I want to click on a node in a tree widget.
I noticed some differences between click() and clickAt() when testing a ExtJS app. For example, if I try to click a tab in a Ext.TabPanel, click() command does not work, although I provide it with an correct xpath, and clickAt() works fine. Code looks like this:
click("//li[@id='tab-panel-id__second-tab-id']/a[2]/em/span/span")
doesn't work, but
clickAt("//li[@id='tab-panel-id__second-tab-id']/a[2]/em/span/span","0,0")
works. Notice that coordinates are (0,0)
I can't figure out why this happens...