Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
selenium javascript hover button with async await
async login(driver:WebDriver) {
await driver.get('https://tiki.vn');
let loginElement = await driver.findElement(By.id('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