使用PHP Selenium禁用图像加载 [英] Disable image loading with PHP Selenium
本文介绍了使用PHP Selenium禁用图像加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何禁用ChromeOptions中的图片加载? (PHP库)
How do you disable image loading in ChromeOptions? (PHP library)
我尝试了以下操作,但不确定语法是否正确
I tried the following but not sure if syntax is correct
$options = new ChromeOptions();
// disable images
$options->addArguments(array(
"service_args=['--load-images=no']"
));
$caps = DesiredCapabilities::chrome();
$caps->setCapability(ChromeOptions::CAPABILITY, $options);
$driver = RemoteWebDriver::create($host, $caps);
推荐答案
要禁用,请使用参数:--blink-settings=imagesEnabled=false
To disable, use the argument: --blink-settings=imagesEnabled=false
$options->addArguments(array(
'--blink-settings=imagesEnabled=false'
));
https://github.com/facebook/php-webdriver/issues/641#issuecomment-512255496
这篇关于使用PHP Selenium禁用图像加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文