Krmat Posted October 5, 2014 Share Posted October 5, 2014 Hi all, I'm struggling to trigger an element event (click) without do click on itself. This page (http://api.jquery.com/click/ - "Demo part") is an example of a " click " event that I'm not been able to use trigger/fireEvent/dispatchEvent. I could use the $oElement.click() or _IEAction($oElement , "click"), but then i would be simulating a click. I'm just trying to trigger the event bounded to the "click" listener. Anyone can help me? Code example do the page above: Local $oIE = _IEAttach ("", "instance", 1) Local $oFrames = _IEFrameGetCollection($oIE, 0) Local $oBody = _IETagNameGetCollection($oFrames, "body", 0) Local $oElement = _IETagNameGetCollection($oFrames, "p", 0) $oElement.trigger('click') ;Not Working - Already tryed "onclick" $oElement.fireEvent('click') ;Not Working - Already tryed "onclick" $oElement.dispatchEvent('click') ;Not Working - Already tryed "onclick" Thanks in advance. Link to comment Share on other sites More sharing options...
Danp2 Posted October 5, 2014 Share Posted October 5, 2014 This seems to work: _IEAction($oElement, "click") Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Krmat Posted October 5, 2014 Author Share Posted October 5, 2014 This seems to work: _IEAction($oElement, "click") Yes it does work, this action simulate a click and trigger the event 'click' bound to the element, but, i'm trying to trigger the event direct, without using $oElement.click() <==>_IEAction($oElement , "click"). When the events (onmousedown -onmouseup - onlick) is inside the tags, i'm able to use trigger/fireEvent/dispatchEvent to manipulate them, but in this case it's not. Have any ideia how i can do that ? Link to comment Share on other sites More sharing options...
Danp2 Posted October 5, 2014 Share Posted October 5, 2014 Sorry... I missed that in your original post. Can you explain why you need to trigger the event directly rather than through the element's click method? Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Krmat Posted October 5, 2014 Author Share Posted October 5, 2014 Sorry... I missed that in your original post. Can you explain why you need to trigger the event directly rather than through the element's click method? i have a auto fill form that has a java button that opens another another form. Sometimes the page does not load completely (not well written i guess), and this button sometimes get disabled and sometimes you click on it and nothing happens, but i always can see the "click" event in the element. So i'm trying to trigger the event without clicking on it. Usually when the event it's inside the element tag (onmousedown - onmouseup - click - etc) i can manipulate it, in this case it's not, and i'm not able do trigger it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now