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

ChromeOptions使用Selenium ChromeDriver for node.js导致参考错误,第1张

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
并阅读源代码。这就是我找出上述方法的方式。



欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4944624.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-13
下一篇2022-11-13

发表评论

登录后才能评论

评论列表(0条)

    保存