[英]How to take runtime input in selenium while automation testing?
I'm trying to take data from user at run time while automating a Webapplication.我试图在运行时从用户那里获取数据,同时自动化 Web 应用程序。 I have searched a lot but I couldn't find anything.
我搜索了很多,但我找不到任何东西。 I have tried this method.
我已经尝试过这种方法。 (code mentioned below)
(下面提到的代码)
Scanner scanner_user = new Scanner(System.in);
System.out.println("Enter your Email or Phone : ");
String user = scanner_user.nextLine();
System.out.println("our otp is " + user.toString());
but It doesn't work .但它不起作用。 it ask to enter data in console but it says read only view.
它要求在控制台中输入数据,但它说只读视图。 please help me how can I take data at runtime.
请帮助我如何在运行时获取数据。
You can use the below in this scenario user is passing the password
manually through console.在这种情况下,您可以使用以下内容,用户通过控制台手动传递
password
。
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String password;
System.out.println("Please Enter the user password :: ");
password= br.readLine();
driver.findElement(By.id("pwd")).sendKeys("password");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.