I was doing an automation fun project and I choose this website https://agoodmovietowatch.com/ this is a single-page website so to target the sign-up link I inspect and find that this sign-up link is not a
<a>
tag but an <h6>
tag and I cant able to target it, I tried all combinations to select it every class it contains but failed.
If someone knows so tell me, please.
here is my code :
await page.waitForSelector("div.tss-1xh7ius-secondaryLinksContainer.MuiBox-root.mui-0 div.text_container__2Nx5h.tss-w9yc2n-secondaryLink.MuiBox-root.mui-0");
await page.click("div.tss-1xh7ius-secondaryLinksContainer.MuiBox-root.mui-0 div.text_container__2Nx5h.tss-w9yc2n-secondaryLink.MuiBox-root.mui-0");
Here is a working solution:
const signUpBtn = await page.$(".tss-1xh7ius-secondaryLinksContainer > div")
await signUpBtn.click()
And to select "the very best", you can use:
await page.click(".tss-1ch6vtq-buttonsContainer :first-child")
If you want to learn more about CSS selectors, I recommend checking out this nice and funny teaching website: CSS Diner