栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

ChromeOptions使用Selenium ChromeDriver for node.js导致参考错误

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

ChromeOptions使用Selenium ChromeDriver for node.js导致参考错误

以下对我有用:

var webdriver = require("selenium-webdriver");var chrome = require("selenium-webdriver/chrome");// Make sure the PATH is set to find ChromeDriver. I'm on a Unix// system. You'll need to adapt to whatever is needed for// Windows. Actually, since you say that you can get a browser to show// up if you don't try to specify options, your ChromeDriver is// probably already on your PATH, so you can probably skip this.process.env["PATH"] += ":/home/user/src/selenium/";var options = new chrome.Options();// Commented out because they are obviously not what you want.// Uncomment and adapt as needed://// options.setChromeBinaryPath("/tmp/foo");// options.addArguments(["--blah"]);var driver = new webdriver.Builder().   withCapabilities(options.toCapabilities()).build();driver.get("http://www.google.com")

我已经使用各种值测试了上面的代码,并发现它可以工作。

如果要查看可以对该

Options
对象执行的其他操作,可以打开
node_modules/selenium_webdriver/chrome.js
并阅读源代码。这就是我找出上述方法的方式。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/383383.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号