Pra*_*abu -1 autoit selenium-webdriver
我的 AutoIt 脚本:
WinWaitActive("User Authentication","","10")
If WinExists("User Authentication") Then
; Enter a username.
Send("prabu{TAB}")
Send("{TAB}")
;Enter a Password.
Send("Password")
Send("{TAB}")
Send("{SPACE}")
;Press Authenticate button.
Send("{TAB} {ENTER}")
EndIf
Run Code Online (Sandbox Code Playgroud)
我将它“编译”为一个 .exe 文件并使用以下命令从 Selenium 执行它:
Runtime.getRuntime().exec("C:\\Users\\Prabu\\Documents\\ds.exe");
Run Code Online (Sandbox Code Playgroud)
但我希望它每次都输入不同的用户名和密码。我打算使用命令行参数(如果你愿意,可以使用参数)将这些提供给脚本。
是否可以将参数/参数传递给 AutoIt 脚本?如果是这样,这应该如何完成以及如何访问提供给我的脚本的参数/参数?
AutoIt 脚本中的更改
$username = $CmdLIne[1]
$password=$CmdLine[2]
Send($username)
Send($password)
Run Code Online (Sandbox Code Playgroud)
在 Java 中
String command="C:\\Users\\Prabu\\Documents\\ds.exe \"username1\" \"password1\"";
Runtime.getRuntime().exec(command);
Run Code Online (Sandbox Code Playgroud)
参考
https://www.autoitscript.com/autoit3/docs/intro/running.htm#CommandLine http://seleniumocean.blogspot.in/2014/11/its-time-for-autoit-parameterizing.html
| 归档时间: |
|
| 查看次数: |
3158 次 |
| 最近记录: |