The function window.getComputedStyle is supposed to be able to get the computed style of pseudo classes like :hover, according to the documentation.
It\
Note that there is a way to do this at least for Chrome with the remote debugging port turned on. Basically you need to use a WebSocket, connect to the remote debugger url, then issue the following commands:
send { id: 1, method: "Inspector.enable" }
send { id: 2, method: "DOM.enable" }
send { id: 3, method: "CSS.enable" }
send { id: 4, method: "DOM.getDocument" }
send { id: 5, method: "DOM.querySelector", params: { nodeId: 1, selector: <> } }
nodeId = response.result.nodeId
send { id: 6, method: "CSS.forcePseudoState", params: { nodeId:, forcedPseudoClasses: [ "hover" <> ] } }
Then you can use the regular getComputedStyle, or the CSS.getComputedStyleForNode debugger API.