Salut � tous,
Nous nous sommes mis dans mon projet � Selenium pour tester notre application. Voulant aller un peu plus loin, je souhaite regrouper les �l�ments variables des scripts dans des fichiers de config'.

J'ai donc d�velopp� un (tout) petit module en javascript, j'ai nomm� toolbox.js. Dans Selenium je souhaite faire appel � l'une de ces fonctions. Voici le contenu d'un de mes scripts de test :

Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head profile="http://selenium-ide.openqa.org/profiles/test-case">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="selenium.base" href="http://localhost/" />
<title>CreationSuppressionBase</title>
 
<!-- Ici on charge le script -->
<script language="JavaScript" type="text/javascript" src="toolbox.js"></script>
</head>
<body>
<table cellpadding="1" cellspacing="1" border="1">
<thead>
<tr><td rowspan="1" colspan="3">CreationSuppressionBase</td></tr>
</thead><tbody>
<tr>
    <td>open</td>
    <td>http://host_cible:9000/api/Ident.jspa</td>
    <td></td>
</tr>
<tr>
    <td>selectFrame</td>
    <td>zone2</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>login</td>
    <td>mon_login</td>
</tr>
<tr>
    <td>type</td>
    <td>password</td>
    <td>mon_password</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>OK</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//table[2]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[2]/td[2]/table/tbody/tr[2]/td/table/tbody/tr[1]/td/a/span</td>
    <td></td>
</tr>
<tr>
    <td>selectFrame</td>
    <td>relative=up</td>
    <td></td>
</tr>
<tr>
    <td>selectFrame</td>
    <td>zone2</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>OK</td>
    <td></td>
</tr>
<tr>
    <td>type</td>
    <td>baseCode</td>
    <td>javascript{getParam(&quot;base_code&quot;);}</td> <!-- Ici on fait appel à la fonction getParam de toolbox.js -->
</tr>
<tr>
    <td>type</td>
    <td>baseLib</td>
    <td>javascript</td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>OK</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>//img[@title='supprimer']</td>
    <td></td>
</tr>
<tr>
    <td>assertConfirmation</td>
    <td>Etes-vous vraiment sûr de supprimer cet élément ?</td>
    <td></td>
</tr>
 
</tbody></table>
</body>
</html>
Dans le header je charge le script, dont j'appelle la fonction dans le corps. Seulement sous l'IDE Selenium, l'appel � du Javascript fonctionne, mais chaque fois j'ai le message d'erreur :
  • [info] Executing: |type | baseCode | javascript{getParam("base_code");} |
  • [error] Unexpected Exception: message -> getParam is not defined, fileName -> chrome://selenium-ide/content/selenium/scripts/selenium-api.js, lineNumber -> 2304, stack -> ("javascript{getParam(\"base_code\");}")@chrome://selenium-ide/content/selenium/scripts/selenium-api.js:2304 ("javascript{getParam(\"base_code\");}")@chrome://selenium-ide/content/selenium/scripts/selenium-api.js:2304 ()@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:110 (7)@chrome://selenium-ide/content/selenium/scripts/selenium-executionloop.js:78 (7)@chrome://selenium-ide/content/selenium/scripts/htmlutils.js:60 , name -> ReferenceError
  • [debug] commandError
  • [debug] testComplete: failed=true
Quelqu'un aurait une id�e l�-dessus ? (et il est possible que ce ne soit pas au bon endroit... je ne savais pas mieux o� poster).

Merci d'avance.