Some of the input boxes are hidden during testing, and if you assign them directly, you will not find the input box, which causes the script to run unsuccessfully.
For example, the following Password entry box:
Login Password input box is divided into two input, the following is the prompt, the above is the real password input box, two input is linkage, the default above input box is hidden, if the direct assignment is not found this input, So it is necessary to change the display property of input from none to block to show it and then assign it to him, or give him a value property directly to assign it.
First, change the display property by JS to show input
Js= "var P=document.getelementbyid (' Password ');p. style.display= ' block ';
Driver.execute_script (JS);
Note: These two sentences can be used to display the "Password" input box, and then can be assigned directly through the Send_keys. JS is Custom, p is also a function of its own definition, you can take a name. Of course, it's possible to connect the two sentences together.
Driver.execute_script ("var P=document.getelementbyid (' Password ');p. style.display= ' block ';");
Second, do not display input, directly to input assignment, plus value
Driver.execute_script ("var Js1=document.getelementbyid (' Txt_confirmpassword '); js1.value= ' 123456 ';");
Driver.execute_script ("var Js2=document.getelementbyid (' ConfirmPassword '); js2.value= ' 123456 ';");
Description: Defines a function that assigns a value to input by js.value= "".
Execute JS, display the hidden input box via JS, or assign a value to input