Use of 'ClickAt ' selenium command

后端 未结 5 1679
感情败类
感情败类 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条回答
  •  Happy的楠姐
    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 ^^

提交回复
热议问题