0

I am working on nodejs, I have added selenium module. right now I am stuck to click on button. I must need to click by moving mouse pointer to element location. And need to click it. So an anyone tell me how we can use ActionSequence to move mouse at particular x y co-ordinates and hit mouse up and down with selenium.

I have searched but I am getting only Java related solution.

0

1 Answer 1

4

Try ActionSequence.mouseMove? Other commands (mouseUp, mouseDown) you can find in https://seleniumhq.github.io/selenium/docs/api/javascript/module/selenium-webdriver/lib/actions_exports_ActionSequence.html too

driver.actions().mouseMove(element).mouseUp().mouseDown().pe‌​rform()

or

driver.actions().mouseMove(element).click().perform()
Sign up to request clarification or add additional context in comments.

9 Comments

I am new to selenium, can you please tell me how can I use it Like :- driver.ActionSeauence.mouseMove(element).mouseUp().mouseDown().perform(); will it work?
I don't use selenium/nodejs, but I guess this should work: driver.actions().mouseMove(element).mouseUp().mouseDown().perform(). But if you only want to "moving mouse pointer to element location and then click it", you can try driver.actions().mouseMove(element).click().perform()
one more thing, I did same for text field driver.findElemet(By.css('.class-name')).then(function(element){ driver.actions().moveMouse(element).click().keyDown(element).sendKeys(element, 'some-text').keyUp().perform(); }); Its not working ....I want to click on textfield add/type text into textfield
for the text field, try this: driver.findElement(By.css('class-name')).sendKeys('some-text)
Mousemove is depreacted instead use .move({origin: buttonElement)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.