MyBB Internal: One or more warnings occured. Please contact your administrator for assistance.
WebPagetest Forums - Scripting problems: click, sendClick

WebPagetest Forums

Full Version: Scripting problems: click, sendClick
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, Meenan,

Thanks for your great WPT. It works very well for me except some scripting problems.

I have a span button on the page looks like:
<span id="btn" clicked="true" >click me</span>
Behind this button, there are some JavaScript code which listens to the click event(Say btn_click()). While this button is hit, btn_click() would send an ajax post request. The question here is: I have tried both "click id=btn" and "sendClick id=btn", neither of these functions trigger btn_click().
I guess it is because what click and sendClick functions have done, is to inject an javascript code into webpage and then use the injected javascript to trigger the DOM event. Due to the security concern, the injected javascript would not be able to call native functions like btn_click() in this case. Am I right?
If I am right, is there any API could simulate a system level mouse click or directly call the native javascript methods(By saying native, I mean the javascript within the webpage)?

Thanks again for your help and time!
I don't think it's a security issue. In Chrome or Firefox the injected javascript has full permission to do whatever it wants since it is from an extension. In IE it uses the c++ DOM bindings. Have you tried just using the exec or execAndWait commands to call btn_click() directly?
Reference URL's