0

PHP 调用 Selenium Chomedriver 设置代理

neo created at5 years ago view count: 2790
$wd_host = 'http://localhost:4444/wd/hub';
$capabilities = [
    WebDriverCapabilityType::BROWSER_NAME => 'firefox',
    WebDriverCapabilityType::PROXY => [
        'proxyType' => 'manual',
        'httpProxy' => '127.0.0.1:2043',
        'sslProxy' => '127.0.0.1:2043',
    ],
];
$driver = RemoteWebDriver::create($wd_host, $capabilities);

// 或者这样设置
               $capabilities->setCapability(\Facebook\WebDriver\Remote\WebDriverCapabilityType::PROXY,  [
                  'proxyType' => 'manual',
                 'httpProxy' => 'http://127.0.0.1:808'
              ]);
report
回复

Recent search keywords