# Query Selectors Queries are the primary mechanism for interacting with the DOM on your site. For example, a typical workflow goes like: ```ts // Import puppeteer import puppeteer from 'puppeteer'; (async () => { // Launch the browser const browser = await puppeteer.launch(); // Create a page const page = await browser.newPage(); // Go to your site await page.goto('YOUR_SITE'); // Query for an element handle. const element = await page.waitForSelector('div > .class-name'); // Do something with element... await element.click(); // Just an example. // Dispose of handle await element.dispose(); // Close browser. await browser.close(); })(); ``` ## `P` Selectors Puppeteer uses a superset of the CSS selector syntax for querying. We call this syntax _P selectors_ and it's supercharged with extra capabilities such as deep combinators and text selection. :::caution Although P selectors look like real CSS selectors (we intentionally designed it this way), they should not be used for actually CSS styling. They are designed only for Puppeteer. ::: :::note P selectors only work on the first "depth" of selectors; for example, `:is(div >>> a)` will not work. ::: ### `>>>` and `>>>>` combinators The `>>>` and `>>>>` are called _deep descendent_ and _deep_ combinators respectively. Both combinators have the effect of going into shadow hosts with `>>>` going into every shadow host under a node and `>>>>` going into the immediate one (if the node is a shadow host; otherwise, it's a no-op). :::note A common question is when should `>>>>` be chosen over `>>>` considering the flexibility of `>>>`. A similar question can be asked about `>` and a space; choose `>` if you do not need to query all elements under a given node and a space otherwise. This answer extends to `>>>>` (`>`) and `>>>` (space) naturally. ::: #### Example Suppose we have the markup ```html

Light content

``` > Note: `