Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mouseButtonClick() is not working same as suggested actions.click() #4131

Open
Eugene753 opened this issue Mar 18, 2024 · 8 comments
Open

mouseButtonClick() is not working same as suggested actions.click() #4131

Eugene753 opened this issue Mar 18, 2024 · 8 comments

Comments

@Eugene753
Copy link

Description

In our automation project we used before mouseButtonClick() to click on elements in canvas based app and it worked as fine. After mouseButtonClick() was depreciated suggested actions.click() is not working the same in all cases. In some cases it clicks and in some it is not working. It looks like Actions API from selenium is not working same mouseButtonClick(). Would it be possible to return this function with new w3c protocols?

Suggested solution

No response

Alternatives / Workarounds

No response

Additional Information

No response

@ParthasarathiMahana
Copy link

Hey @Eugene753, From you explaination what I can understand is, before you were using "mouseButtonClick()" which was working fine, but now it is deprecated and you are using "actions.click()" which is working sometimes but sometimes it is not. Just wanted to confirm once.

@ParthasarathiMahana
Copy link

I would love to work on this.

@ParthasarathiMahana
Copy link

@Eugene753 Can You please tell me are you getting any errors if the click is not performed?

@Eugene753
Copy link
Author

Eugene753 commented Mar 19, 2024

Hey @ParthasarathiMahana, thank you for the reply, there is no specific error in this case, it is basically not performing a click. This is a canvas based app and before clicking it is identifying where object located on the screen before clicking. In the project, version 1.7 nightwatch is used but we trying to upgrade to newer version. We used actions.click to perform simple left button click and it is working for the most part but in some cases it is simply not clicking at the coordinates where object is located.

@aryan262
Copy link

Hey @Eugene753
In Selenium, actions.click() and WebElement.click() differ in their interaction with webpage elements. actions.click() simply sends a click event to the specified element, regardless of its state. However, WebElement.click() requires the WebElement to be visible before clicking.
If actions.click() doesn't work as expected, the element's state at the time of action could be the cause. Ensuring the element is clickable before performing the action might help. If issues persist, consider other methods like clickAndHold() or alternative interaction methods.
And about that mouseButtonClick() with new W3C protocols, it's up to the Selenium project maintainers. Given the trend towards W3C standardization, it's unlikely that deprecated methods will be reintroduced. The focus is likely on enhancing existing methods to work effectively under W3C protocols.

@Eugene753
Copy link
Author

In our case it is a bit different because this is canvas, elements of canvas are not present in the DOM and we have a way to access them but mouseButtonClick() used to work in our case and actions.click() not consistently working for some reason.

@garg3133
Copy link
Member

@Eugene753 Can you share a code snippet on how you're performing the click action? Ideally, the click action should always perform the click on the coordinates provided (or wherever the mouse pointer is present). So, the problem could also be something else (maybe the pointer is not moving to the object in some cases), although I'm not sure.

It would also be very helpful if we could somehow reproduce this issue on our end because it is very difficult to fix something that is not reproducible.

@Eugene753
Copy link
Author

Eugene753 commented Mar 29, 2024

@garg3133 I can't share code cause this is not my personal project, but in general the code is complicated, with 3 different custom commands nested, but the bottom line that mouseButtonClick() is working but action.click() is not working at the same kind scenario, so I thought someone can help to point out the maybe major differences between those two commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants