Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Simulating clicks with Javascript for Webdriver

    SmartGWT 2.2, Firefox 3.6.10 running on Ubuntu 10.04 LTS

    I'm waiting for the Webdriver guys to integrate some stuff they've done on native events for Linux into their mainline, but in the meantime if I could get some help with a way to hack around it I'd be very appreciative.

    What I want to know is, if I have the x,y coordinates of the widget I want to click on, can I execute some javascript to either trigger a mouse event on the Smart widget that is rendered at that point (either a click() or the mousedown/mouseclick/mouseup series) or somehow get a handle on the "real" Smart widget so I can execute its click()?

    I can use an XPath to get Webdriver to give me a WebElement, but that's some random internal chunk of DOM and not actually the object which has the Smart click() method on it. I can get the dimensions and x,y coordinates of it though, so if I can simulate a click there or somehow get a handle on the Smart widget representing that section of the screen I can call its click() and that'll get me out of trouble.

    (Yes, I know we should be using scLocators; but 1) they're not well documented, 2) they didn't exist when we started the project, 3) not all of the widgets we're using descend from BaseWidget such that we can set an ID on them and 4) all our tests work with XPaths right now and I want to avoid rewriting them more than once, which I'll do when I can get comprehensive docs on scLocators.)

    Cheers, Robert.
Working...
X