Wednesday, November 13, 2013

Adding a custom locator type in selenium IDE


LocatorBuilders.add('css:auto', function(e) {
    var value = e.getAttribute('class');   
    if (value.indexOf('auto_') != -1) {
     var s=str.indexOf('auto_');
     alert(value.substr(s))
        return value.substr(s) ; 
    }
return null;
});

Above code needs to be added in a js file.I have named it as "csslocators.js" .The above function will extract the class attribute of the element starting with "auto_"


This js file needs to be added to SIDe as ->options->options->in side extensions.Click on browse and select the file.

if u want ur locator type to be listed first,then u can do it in side->options->options->locator builders-> rearrange the items.


No comments:

Post a Comment