When i set headless: true (without open browser) in Puppeteer i have error Error: 

> 
> Evaluation failed: TypeError: Cannot read property 'click' of
>  undefined at **puppeteer\_evaluation\_script**:3:115
> 
> 
> 

I add that if is headless: false (with open browser) the script works correctly...
From my observations, it appears that the error occurs while performing this function

```
await page.evaluate( () =>
    {
    Array.from( document.querySelectorAll( '.N3ewq' ) ).filter( element => element.textContent == 'Switch' )[0].click();
    });

```

How can I fix it? Thanks for all suggestions