最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How can use puppeteer with my current chrome (keeping my credentials) - Stack Overflow

programmeradmin0浏览0评论

i'm actually trying to use puppeteer for scraping and i need to use my current chrome to keep all my credentials and use it instead of relogin and type password each time which is a really time lose !

is there a way to connect it ? how to do that ? i'm actually using node v11.1.0 and puppeteer 1.10.0

let scrape = async () => {
const browser = await log()
const page = await browser.newPage()           
const delayScroll = 200
// Login 
await page.goto('somesite');
await page.type('#login-email', '*******);
await page.type('#login-password', "******");
await page.click('#login-submit');
// Wait to login
await page.waitFor(1000);

}

and now it will be perfect if i do not need to use that and go on page (headless, i dont wan't to see the page opening i'm just using the info scraping in node) but with my current chrome who does not need to login to have information i need. (because at the end i want to use it as an extension of chrome)

thx in advance if someone knows how to do that

i'm actually trying to use puppeteer for scraping and i need to use my current chrome to keep all my credentials and use it instead of relogin and type password each time which is a really time lose !

is there a way to connect it ? how to do that ? i'm actually using node v11.1.0 and puppeteer 1.10.0

let scrape = async () => {
const browser = await log()
const page = await browser.newPage()           
const delayScroll = 200
// Login 
await page.goto('somesite.');
await page.type('#login-email', '*******);
await page.type('#login-password', "******");
await page.click('#login-submit');
// Wait to login
await page.waitFor(1000);

}

and now it will be perfect if i do not need to use that and go on page (headless, i dont wan't to see the page opening i'm just using the info scraping in node) but with my current chrome who does not need to login to have information i need. (because at the end i want to use it as an extension of chrome)

thx in advance if someone knows how to do that

Share Improve this question asked Nov 14, 2018 at 15:45 Lucas ContuLucas Contu 531 silver badge4 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

First wele to the munity.

You can use Chrome instead of Chromium but sincerely in my case, I get a lot of errors and cause a mess with my personal tabs. So you can create and save a profile, then you can login with a current or a new account.

In your code you have a function called "log" I'm guessing that there you set launch puppeeteer.

const browser = await log()

Into that function use arguments and create a relative directory for your profile data:

const browser = await puppeteer.launch({
    args: ["--user-data-dir=./Google/Chrome/User Data/"]
});

Run your application, login with an account and the next time you enter you should see your credentials

Any doubt please add a ment.

发布评论

评论列表(0)

  1. 暂无评论