java - Selenium: How to prompt user input and use the input value? -


I have a condition (during selenium testing), in which the user will receive a security code. The security code must be input before allowing the user to continue.

I am not sure how I can get the value of user input. I browsed around and came with this. Unfortunately, this does not work much.

  JavaScript Explorer JS = (JavaScript Extractor) driver; Js.executeScript ("window.promptResponse = sign ('Please enter security code')"); If (isAlertPresent ()) {// switch alert alert warning = driver. SwitchTo (). Warning (); // user input text thread, sleep (10000); // This code = (string) js.executeScript ("return window.promptResponse") does not seem to work; Alert.accept ();  

Can someone tell me in the right direction?

It seems that before you store and use the value, accept the prompt first and Close

  alert.accept (); Code = (string) js.executeScript ("return window.promptResponse");  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -