Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in DevOps and Agile by (19.7k points)

The Story:

One of the approaches to solve captchas, like Google ReCaptcha, is to try to imitate the human-mouse actions: movements, hovering and clicks.

Some users reported that making the mouse moves as B-spline curves worked for them.

The Question:

How to move the mouse to a particular element following the B-spline trajectory via Selenium?


Note that the regular browser.actions().mouseMove(elm).perform(); would "jump" to the element straight and far too quickly. My understanding is that it is a matter of slowing down the movement speed, "jumping" from point to point smoothly following the mathematical model for the B-spline trajectory.

We are using Protractor/JavaScript, but the question is really language-agnostic. Note that I'm not trying to solve the captcha, or contribute to the "captcha-solving making new evil bots violating terms of use here and there" space. I'm just curious and eager to obtain more skills in the test automation space.

1 Answer

0 votes
by (62.9k points)

Selenium only works with a browser-driver. So you won't be able to move outside the working area, i.e. your browser.

 

You can make use of the java method called Actions to perform the same acts. If you have the coordinate where to click, you can try this.

Actions builder = new Actions(driver);   

builder.moveToElement(element, X, Y).click().build().perform();

Hope this helps.

If you are interested to learn Selenium on a much deeper level and want to become a professional in the testing domain, check out Intellipaat’s Selenium certification!

Browse Categories

...