I was writing a Selenium IDE extension so that clicking on certain kinds of links would record a custom command instead of the default "click" command. In my ide-extensions.js file, I had written:
Recorder.decorateEventHandler(
'clickLocator',
'click',
function (handler) {
return function (event) {
this.record('testingIt', 'inside', 'decorator');
handler.call( this, event );
};
}
);
If all went right, when I clicked a link, it would record the command "testingIt inside decorator" and then record the typical "click" command. However, when starting Selenium IDE I got the message error loading Selenium IDE extensions: TypeError: handlers is undefined
After much trial and error and reading a good portion of the Selenium IDE source code, I noticed that when the 'clickLocator' EventHandler is defined, it's defined with capture : true. By specifying that option when calling decorateEventHandler, everything works as expected. This was the testing code that finally worked:
Recorder.decorateEventHandler(
'clickLocator',
'click',
function (handler) {
return function (event) {
this.record('testingIt', 'inside', 'decorator');
handler.call( this, event );
};
},
{ capture : true }
);
2 comments:
Hi hendrick,
Im a java developer and am currently working on designing an extension for the selenium IDE which would record all the verify or assert actions in a separate window which will ultimately be exported as an xml file.
I am having problems understanding the source code and all and still do not know how to achieve my aim. Can you please help me by providing some links or maybe some tutorial tht u are aware of..??
with regards,
Mohit.
Mohit, your best bet will be to visit the Selenium support page.
Post a Comment