Use of 'ClickAt ' selenium command

后端 未结 5 1660
感情败类
感情败类 2020-12-31 05:24

I\'m confused about the difference between the Click and ClickAt commands in selenium. Where can I use the ClickAt command?

相关标签:
5条回答
  • 2020-12-31 05:42

    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...

    0 讨论(0)
  • 2020-12-31 05:43

    Be careful when testing clickAt. Sometimes double clicking the command will cause it to show up red. You will change the line to try other alternatives but nothing will work. But then run your script and the clickAt line will be fine with whatever you type in.

    0 讨论(0)
  • 2020-12-31 05:44

    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.

    0 讨论(0)
  • 2020-12-31 05:58

    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 ^^

    0 讨论(0)
  • 2020-12-31 05:58

    There is a dojo widget at our application which only works with clickAt("//span[@id='mastheadIconBar']/span[1]/span/span","0,0").

    Don't know why, but only click("//span[@id='mastheadIconBar']/span[1]/span/span") does not work.

    0 讨论(0)
提交回复
热议问题