0

我正在构建 Web 测试代码,但第一次启动时出现错误

代码开头似乎有问题,但由于不知道而无法捕捉

 -error
 local.ERROR: Undefined class constant 'pageLoadStrategy' {"exception":"[object] 
(Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Undefined class constant 
'pageLoadStrategy' at /var/www/app/Service/SeleniumSet/Set.php:38)

 -code
 $host = env('SELENIUM_HOST'); // this is the default
 $capabilities = DesiredCapabilities::chrome();
 $capabilities->setCapability(ChromeOptions::CAPABILITY, $options);
 $capabilities->setCapability(ChromeOptions::pageLoadStrategy, 'nomal');
 $this->driver = RemoteWebDriver::create($host, $capabilities, 7000);
 $this->driver->executeScript("Object.defineProperty(navigator, 'plugins', {get: function() {return[1, 2, 3, 4, 5];},});");
    return $this->driver;
4

1 回答 1

0

而不是应该是nomal,有效地:pageLoadStrategynormal

$capabilities->setCapability(ChromeOptions::pageLoadStrategy, 'normal');

参考

您可以在以下位置找到一些相关的讨论:

于 2020-06-29T09:01:57.817 回答