browsertime
browsertime copied to clipboard
The param scriptInput.visualElements doesn't work well with pseudo classes tr:first-child
Have you read the documentation?
- [x] Yes, I've read the how to make a reproducable bug guide
- [x] Yes, I've read the how to debug my script guide
URL
https://youtrack.jetbrains.com
What are you trying to accomplish
Summary
I would like to use pseudo classes like tr:first-child for the selector --scriptInput.visualElements.
Steps
Pass the argument --scriptInput.visualElements VisualElementName:tr:first-child
Actual result
The selector will be tr instead of tr:first-child
because
https://github.com/sitespeedio/browsertime/blob/v24.7.0/browserscripts/pageinfo/visualElements.js#L92C1-L95C61
const parts = nameAndSelector.split(':');
const type = parts[0];
const selector = parts[1];
const element = document.body.querySelector(selector);
Expected result
const selector = nameAndSelector.split(':', 2);
What browser did you use?
Chrome
How to reproduce
Pass the argument `--scriptInput.visualElements VisualElementName:tr:first-child`
Log output
const selector = nameAndSelector.slice(nameAndSelector.indexOf(':') + 1);
https://github.com/sitespeedio/browsertime/pull/2298