I think waiting a set amount of time before capturing a snapshot is not ideal.
Instead I think using Page.waitForSelector() might work better. This means that once the data is loaded and rendered you can capture it without wasting any time.
To use this option there'd be a flag like --selector (and perhaps -s) that is passed to the function above directly.
I would be happy to try implementing this but before I would like some opinions on some details:
Should it timeout at some point? After 10s or more?
Should it throw on timeout?
Personally, I don't see the need for XPath.
I think it should timeout, but maybe after 30s or so by default and be overridable with --wait.
I'm not too sure about throwing, but it might be beneficial to know that it timed out.
I think waiting a set amount of time before capturing a snapshot is not ideal.
Instead I think using
Page.waitForSelector()
might work better. This means that once the data is loaded and rendered you can capture it without wasting any time. To use this option there'd be a flag like--selector
(and perhaps-s
) that is passed to the function above directly.I would be happy to try implementing this but before I would like some opinions on some details:
Page.waitForXPath()
? (--xpath
?)Personally, I don't see the need for XPath.
I think it should timeout, but maybe after 30s or so by default and be overridable with
--wait
.I'm not too sure about throwing, but it might be beneficial to know that it timed out.