从php silenum无法使用autoit
我需要在带有cygwin64的Windows 7上使用selenium对代理进行身份验证。我尝试使用AuthIt登录到我的代理从php silenum无法使用autoit,php,selenium-webdriver,autoit,Php,Selenium Webdriver,Autoit,我需要在带有cygwin64的Windows 7上使用selenium对代理进行身份验证。我尝试使用AuthIt登录到我的代理 $host = 'http://localhost:4444/wd/hub'; $c = array( WebDriverCapabilityType::BROWSER_NAME => 'firefox', WebDriverCapabilityType::PROXY => array( 'proxyType' =>
$host = 'http://localhost:4444/wd/hub';
$c = array(
WebDriverCapabilityType::BROWSER_NAME => 'firefox',
WebDriverCapabilityType::PROXY => array(
'proxyType' => 'manual',
'httpProxy' => 'my.proxy.net:80'));
$driver = RemoteWebDriver::create($host, $c);
//LOOKS LIKE IT FREEZE HERE FOR 30 seconds!
// and is not going to go to 'exec'
$driver->get("http://www.whatismyip.com/");
$r = exec('../../bin/proxy_auth.exe', $a, $b);
其中proxy_auth.exe转换为AutoIt脚本
WinWait("Authentication Required","",30)
WinActivate ("Authentication Required")
If WinExists("Authentication Required") Then
Send("log{TAB}")
Send("pwd{Enter}")
EndIf
如果我以独立方式运行AutoIt脚本,则一切正常。但在php脚本中,它找不到窗口。处理窗口操作时,您需要设置以下选项:
#RequireAdmin Opt("WinSearchChildren", 1) ; 1=search children also
Opt("WinTitleMatchMode", 4) ; 4=advanced
Opt("WinDetectHiddenText", 1) ; 1=do detect
同时Send()将按键发送到任何活动窗口。安全的方法是:
ControlSend ( "title", "text", controlID, "string" [, flag = 0] )