public function __construct($config = []) { parent::__construct($config); $getAllSessions = RemoteWebDriver::getAllSessions($this->host); if ($this->sessionId && ArrayHelper::inMultiArray($this->sessionId, $getAllSessions, 'id')) { $this->driver = RemoteWebDriver::createBySessionID($this->sessionId, $this->host); } else { $desired_capabilities = DesiredCapabilities::firefox(); $fp = new FirefoxProfile(); $desired_capabilities->setCapability(WebDriverCapabilityType::NATIVE_EVENTS, true); if (isset($this->proxy['ip'])) { $this->proxy['port'] = ArrayHelper::getValue($this->proxy, 'port'); $fp->setPreference('network.proxy.ssl_port', $this->proxy['port']); $fp->setPreference('network.proxy.ssl', $this->proxy['ip']); $fp->setPreference('network.proxy.http_port', $this->proxy['port']); $fp->setPreference('network.proxy.http', $this->proxy['ip']); $fp->setPreference('network.proxy.type', 1); } $desired_capabilities->setCapability(FirefoxDriver::PROFILE, $fp); $this->driver = RemoteWebDriver::create($this->host, $desired_capabilities, 600000, 600000); $this->sessionId = $this->driver->getSessionID(); } }