Intro: In my project we use CodeceptJS with Puppeteer driver, we also use the configuration waitForNavigation set to DOMContentLoaded
which does not wait for external resources to be loaded, including stylesheets and images, to start interacting with the page.
Question: Considering the stylesheets might not be loaded, would puppeteer be unable to find elements by CSS selector?
Puppeteer will find elements by CSS selector if element exist DOM. It doesn't matter if CSS files are loaded or not.
But..
If you use waitForSelector
with visible: true
option, Puppeteer will be wait for element to be present in DOM and to be visible, i.e. to not have display: none
or visibility: hidden
CSS properties.
https://pptr.dev/#?product=Puppeteer&version=v1.20.0&show=api-pagewaitforselectorselector-options