Is there a way to move the mouse to a specified element in selenium web driver using NodeJS?

Viewed 41

I could only find a lot of Java examples everywhere.


Im trying to do the exact same eg as performed in java but trying to do this in NodeJS instead. 


Java eg:

WebElement canvasElement = driver.findElement(By.id("flashlight-overlay"));
Actions builder = new Actions(driver);
builder.moveToElement(canvasElement).sendKeys("something").sendKeys(Keys.ENTER).build().perform();

How is the above example scripted using NodeJS? I have tried the below referring to the, documentation

let element = await driver.wait(webdriver.until.elementLocated(By.xpath("//canvas[@id='flashlight-overlay']")));
const actions = driver.actions();
const mouse = actions.mouse();
actions.pause(mouse).move({origin: element}).press().release();
actions.sendKeys("SSS").sendKeys(webdriver.Key.ENTER);
actions.perform();

Perform actions works, but the keys "SSS" is not added to the search, i think the navigate to element is not working.

0 Answers
Related