Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Browser closes during debugging #72

Closed
saalmaan opened this issue Dec 27, 2018 · 2 comments
Closed

Browser closes during debugging #72

saalmaan opened this issue Dec 27, 2018 · 2 comments
Labels
question Further information is requested

Comments

@saalmaan
Copy link

saalmaan commented Dec 27, 2018

Hello,

I have got few questions, not sure if should have created multiple issues.

Question: Using below code (example code), when I am debugging, browser window closes suddenly not letting me finish stepping through my code. Am I missing any config option?

const cluster = await Cluster.launch({
    concurrency: Cluster.CONCURRENCY_CONTEXT,
    maxConcurrency: 2,
    monitor: true,
    retryLimit: 0,
    puppeteerOptions: {
      headless: false,
      devtools: true,
      defaultViewport: {
        width: 1920,
        height: 1080
      }
    }
  });

await cluster.queue('www.example.com', main);

const main = async ({ page, data: url }) => {
    await page.goto(url);
    const results = await page.evaluate(async () => {
    debugger;
      let title = document.title;
      return title;
    }).then((data) => {
      console.log(data);
    });
  };

thanks

@saalmaan saalmaan changed the title Multiple questions about debugging, browser launch with parameters... Multiple questions about debugging, launching browser with parameters... Dec 27, 2018
@saalmaan saalmaan changed the title Multiple questions about debugging, launching browser with parameters... Browser closes during debugging Dec 28, 2018
@saalmaan
Copy link
Author

saalmaan commented Dec 31, 2018

adding timeout to cluster config and giving it higher number fixed my issues

const cluster = await Cluster.launch({
    concurrency: Cluster.CONCURRENCY_CONTEXT,
    maxConcurrency: 2,
    monitor: true,
    retryLimit: 0,
    timeout: 180000,
    puppeteerOptions: {
      headless: false,
      devtools: true,
      defaultViewport: {
        width: 1920,
        height: 1080
      }
    }
  });

await cluster.queue('www.example.com', main);

const main = async ({ page, data: url }) => {
    await page.goto(url);
    const results = await page.evaluate(async () => {
    debugger;
      let title = document.title;
      return title;
    }).then((data) => {
      console.log(data);
    });
  };

Once I am done debugging, I shall reduce it to 30000 for production environment.

@thomasdondorf thomasdondorf added the question Further information is requested label Jan 3, 2019
@thomasdondorf
Copy link
Owner

Guess you already solved the problem yourself. If you want to debug your code just set the timeout to some high value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants