New User extensions
Adding new User extensions to Selenium Framework
What if an user wanted a new selenium feature to do enter certain word n number of times? if he needs to add a new function "multiplyString", he should understand Actions. All methods on the Selenium prototype beginning with “do” are added as actions. For each action xxx there is also an action xxxAndWait registered. An action method can have maximum two parameters, which will be passed the second and third column values in the test.
Let us take our example:
It could be as funny as triple click requirement , where yiou can do for i =3, i-- this.page().clickElement(locator);
Here are some more example which user contributed back:Contributed+User-Extensions
What if an user wanted a new selenium feature to do enter certain word n number of times? if he needs to add a new function "multiplyString", he should understand Actions. All methods on the Selenium prototype beginning with “do” are added as actions. For each action xxx there is also an action xxxAndWait registered. An action method can have maximum two parameters, which will be passed the second and third column values in the test.
Let us take our example:
Selenium.prototype.doMultiplyString = function(locator, number) { // All locator-strategies are automatically handled by "findElement" var element = this.page().findElement(locator); // Create the input var valueToType = number*"x"; // Replace the element text with the new text this.page().replaceText(element, valueToType); };
It could be as funny as triple click requirement , where yiou can do for i =3, i-- this.page().clickElement(locator);
Here are some more example which user contributed back:Contributed+User-Extensions
Hi,
ReplyDeleteCan you please explain where to place these user defined functions (in webdriver) so that selenium will make use of this method.