我正在使用Webdriver,但还没有找到使用PHP设置IP代理的方法。
我尝试了以下方法:
$webdriver = new WebDriver("localhost", "4444");
$webdriver->connect("chrome");
$webdriver->setHttpProxy("myhttpproxy:3337");
$webdriver->setCapability("proxy", proxy);
$webdriver->get("http://www.google.com/");
返回:
Notice: Undefined offset: 1 in C:\xampp\htdocs\selenium\phpwebdriver\WebDriver.php on line 58
Notice: Trying to get property 'sessionId' of non-object in C:\xampp\htdocs\selenium\phpwebdriver\WebDriver.php on line 60
Fatal error: Uncaught Error: Call to undefined method WebDriver::setHttpProxy() in C:\xampp\htdocs\selenium\example.php:24 Stack trace: #0 {main} thrown in C:\xampp\htdocs\selenium\example.php on line 24
在此库中是否可以使用一种方法来设置代理?