Bonjour,
J'ai une fonction java script qui permet de crypter le mot de passe de l'utilisateur.
je rencontre l'erreur ci-dessous lors de l'automatisation de l'action.
Voici une partie de la page login :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5 function Test(){ var PasswordParam=document.getElementById("frm1:password"); var SaltParam=document.getElementById("frm1:u_p_salt"); PasswordParam.value=getEncrypted(PasswordParam.value,SaltParam.value); }
Code html : 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 <input id="frm1:password" name="frm1:password" type="password" class="ui-inputfield ui-password ui-widget ui-state-default ui-corner-all primefaces-inputText" aria-required="true" autocomplete="off" placeholder="Password" onkeypress="return isEnterPressed(event);" /> <script id="frm1:password_s" type="text/javascript"> $(function() { PrimeFaces.cw("Password", "widget_frm1_password", { id: "frm1:password" }); }); </script> <input id="frm1:u_p_salt" type="hidden" name="frm1:u_p_salt" value="6eb4443d-f2cf-4k" /> <button id="frm1:loginButton" name="frm1:loginButton" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" onclick="PrimeFaces.bcn(this,event,[function(event){pgshfun();$.removeCookie('freya_expandeditems', {path: '/'});},function(event){PrimeFaces.ab({s:"frm1:loginButton",f:"frm1",p:"frm1",u:"frm1"});return false;}]);" style="margin-top:20px;" type="submit"> <span class="ui-button-text ui-c">Login</span> </button> <script id="frm1:loginButton_s" type="text/javascript"> $(function() { PrimeFaces.cw("CommandButton", "widget_frm1_loginButton", { id: "frm1:loginButton" }); }); </script>
J'ai cette erreur, si vous pouvez aider svp je suis novice en javascript.
2023-05-10 08:55:21,417 ERROR o.a.j.p.j.s.JSR223Sampler: Problem in JSR223 script Echantillon JSR223, message: javax.script.ScriptException: TypeError: Cannot read property "getElementById" from undefined in file:/C:/test/data/javascript/test.js at line number 10
javax.script.ScriptException: TypeError: Cannot read property "getElementById" from undefined in file:/C:/Users/ikane/Desktop/EMW%20Project/testperf/data/javascript/pgsh1.js at line number 10
at jdk.nashorn.api.scripting.NashornScriptEngine.throwAsScriptException(NashornScriptEngine.java:477) ~[jdk.scripting.nashorn]
at jdk.nashorn.api.scripting.NashornScriptEngine.evalImpl(NashornScriptEngine.java:433) ~[jdk.scripting.nashorn]
at jdk.nashorn.api.scripting.NashornScriptEngine$3.eval(NashornScriptEngine.java:521) ~[jdk.scripting.nashorn]
at javax.script.CompiledScript.eval(CompiledScript.java:89) ~[java.scripting]
Partager