Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
selenium javascript hover button with async await
async login(driver:WebDriver) {
await driver.get('');
let loginElement = await driver.findElement('header-user'));
let strJavaScript = "var element = arguments[0];"
+ "var mouseEventObj = document.createEvent('MouseEvents');"
+ "mouseEventObj.initEvent( 'mouseover', true, true );"
+ "element.dispatchEvent(mouseEventObj);";
await driver.executeScript(strJavaScript, loginElement);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment