selenium-webdriver - chrome无头浏览器不打开网址
问题描述
我在 chrome 无头浏览器上运行我的脚本,但它没有启动 url。
铬版本:70.0,铬驱动:2.44
System.setProperty("webdriver.chrome.driver","C:\\path\\to\\chromedriver.exe");`
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--headless");
chromeOptions.addArguments("window-size=1400,600");
WebDriver driver = new ChromeDriver(chromeOptions);
driver.get(url);
上面的代码适用于任何其他网址,但我要启动的网址没有打开。此代码能够在 phantomjs 中启动 url,也可以在没有 headless 的情况下启动 chrome。
当试图在无头浏览器中获取页面源时,我得到了。
<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>
任何帮助appriciated。
解决方案
推荐阅读
- r - 使用 readOGR 循环读取 shapefile
- mongodb - 猫鼬更新查询
- javascript - JavaScript 表单验证:即使参数为 false,if 语句也会运行 select 标记
- java - 如何实现体面的“坏词过滤”?
- python - 在 Python 2.7 中连接两个关于键/值对的字典列表
- azure - 从 Azure 存储队列导出到 CSV 文件
- javascript - Vue中从数组中获取数据
- scala - 当 scala 中已经指定了类型时,类型不匹配
- javascript - 重复的可扩展图像网格失去功能
- c++ - 远程登录调试触发 Roaming::RoamingCacheException loading ntdll.dll