étapes pour une solution globalement réutilisable est comme suit
1) Télécharger sideflow.js de Download here
2) Ajouter les lignes suivantes en elle:
Selenium.prototype.doTypeRandomName = function(locator) {
/**
* Sets the value of an input field to a random email id,
* as though you typed it in.
*
* @param locator an <a href="#locators">element locator</a>
*/
// All locator-strategies are automatically handled by "findElement"
var element = this.page().findElement(locator);
/* The following block generates a random email string */
var allowedChars = "abcdefghiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
var stringLength = 8;
var randomstring = '';
for (var i=0; i<stringLength; i++) {
var rnum = Math.floor(Math.random() * allowedChars.length);
randomstring += allowedChars.substring(rnum,rnum+1);
}
// Replace the element text with the new text
this.browserbot.replaceText(element, randomstring);
};
3) Enregistrez le fichier
4) Aller à Sélénium -> Options ure -> Options -> Selenium Core extensions -> donnez la référence de votre fichier là.
5) Maintenant, votre fonction de nom aléatoire apparaîtra dans auto-intellisense et sera comme catégorie de commande "typerandomname".
6) Exemple d'utilisation pourrait être (si l'URL de base est google.com)
<tr>
<td>open</td>
<td>/</td>
<td></td>
</tr>
<tr>
<td>typerandomname</td>
<td>css=input[class='gbqfif']</td>
<td></td>
</tr>
Hope this vous aide
darn.J'essayais 'javascript:'. Je ne connaissais pas la syntaxe '{}'. Merci! – mpen