Node.js 为什么';我的Chrome配置文件不能连接吗?(硒和铬)
为什么我的Chrome个人资料无法连接? 我打开浏览器并登录到我的Google帐户(用我自己的手,没有web驱动程序),然后我在脚本中连接我的Chrome配置文件,理论上Selenium应该已经登录到我的Google帐户,但这不会发生 代码:Node.js 为什么';我的Chrome配置文件不能连接吗?(硒和铬),node.js,selenium,google-chrome,selenium-webdriver,Node.js,Selenium,Google Chrome,Selenium Webdriver,为什么我的Chrome个人资料无法连接? 我打开浏览器并登录到我的Google帐户(用我自己的手,没有web驱动程序),然后我在脚本中连接我的Chrome配置文件,理论上Selenium应该已经登录到我的Google帐户,但这不会发生 代码: const {Builder, By} = require('selenium-webdriver'); const chrome = require('selenium-webdriver/chrome'); const until = require(
const {Builder, By} = require('selenium-webdriver');
const chrome = require('selenium-webdriver/chrome');
const until = require('selenium-webdriver/lib/until');
const screen = {
width: 1240,
height: 720
};
let option = new chrome.Options().addArguments("user-data-dir=C:\\Users\\Kulic\\AppData\\Local\\Google\\Chrome\\User Data\\Default").headless().windowSize(screen);
let driver = new Builder()
.forBrowser('chrome')
.setChromeOptions(option)
.build();
let adidas_url = "http://www.google.com";
driver.get(adidas_url)
.then(() => {
setTimeout(() => {
driver.takeScreenshot()
.then(
function(image, err) {
require('fs').writeFile('out.png', image, 'base64', function(err) {
console.log(err);
});
driver.quit();
}
);
}, 4000);
});
});
我可能会在截图中发现这不起作用,我的Google帐户应该在右上角,此时系统会提示我登录我的帐户。