Open ollie-iterators opened 2 years ago
@ollie-iterators could you please be more explicit about what your topic is? It would be helpful to have some code examples or links to get an understanding of your request. Thanks.
I'm not sure what "force the element state" means, or quite what devtools functionality you're referring to. Please reopen if you are able to provide more detail on the missing functionality.
If you right click on an element in the browser (Chrome or FireFox), and click Inspect, then you will go to the developer tools. There will be an option visible on the screen called ":hov" which is near the text saying "Filter Styles". It allows you to force the element into a certain state. The states that the element can be forced to are: :hover, :active, :focus, :focus-visible, :focus-within, :visited, :target.
In Safari, you can right click on the element, press Inspect Element, which again goes to the developer tools. Right clicking on the code for an element shows a button in the user interface that says Change pseudo class. The pseudo classes that it can change to are the same as the ones for Chrome and FireFox
It sounds like that this is what CDP offers via: https://chromedevtools.github.io/devtools-protocol/tot/CSS/#method-forcePseudoState
Ok, but it would be good if there was an option to do that without CDP so that it could work on other browsers
Sure, WebDriver BiDi is independent. My comment was just about a reference point that could be used when designing the API for that feature request.
I have noticed that you can force an element to go into a certain state in the different browsers (Chrome, Firefox, Safari). I have tried to see how to do that with a webdriver, but it is impossible to find a way to do that without the Developer tools.
I think it would be a good feature to have the ability to force element state without using the developer tools for a browser.