0

I am struggling and was hoping someone could point me in the right direction. I am using puppeteer sharp in a .net desktop project.

I want to make to page loaded into puppeteer to scroll to the bottom to deal with some lazy loading, and I have found several articles such as Puppeteer - scroll down until you can't anymore that contain loads of useful info, but for Javascript - I can't work out how to implement this in Puppeteer sharp.

For example I would like to try running this under puppeteer sharp somehow (as I read in the above mentioned article it will do the scroll to bottom) : -

await page.evaluate(() => {
  window.scrollBy(0, window.innerHeight);
});

The documentation for puppeteer sharp doesnt seem to cover the above.

cyr

hardkoded
  • 18,915
  • 3
  • 52
  • 64

1 Answers1

0

You should be able to do

await page.EvaluateExpressionAsync("window.scrollBy(0, window.innerHeight)");
hardkoded
  • 18,915
  • 3
  • 52
  • 64
  • Hi thankyou for your reply. Would I put that before or after the page.Goto ? – cyrilaldertonmods1946 Sep 24 '20 at 13:14
  • Hello again. Please ignore that last question it works now - it is called after. Is there a way to capture the URL's from a – cyrilaldertonmods1946 Sep 25 '20 at 18:37
  • @cyrilaldertonmods1946 what do you mean with capture? – hardkoded Sep 25 '20 at 18:41
  • The – cyrilaldertonmods1946 Sep 25 '20 at 18:46
  • Hello again. I realise now I need to use redirect chain, however I am able to see reference in node js for redirect chain but not how to do it in puppeteer sharp. The docs say nothing about supporting it, so is it impossible with puppeteer sharp please? If so how can it be done if possible to tell / share? – cyrilaldertonmods1946 Sep 26 '20 at 02:31
  • How about this https://github.com/hardkoded/puppeteer-sharp/blob/2196ff46d9b31e75dd8dfddbaeac0c5cabeab9b9/lib/PuppeteerSharp.Tests/NetworkTests/SetRequestInterceptionTests.cs#L312 ? – hardkoded Sep 26 '20 at 11:45