-
-
Notifications
You must be signed in to change notification settings - Fork 424
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
'appium:nativeWebTap':true only works for the first click #2510
Comments
Do you have the full appium server log? I think it has coordinate-related logs to send a click with coordinate action. |
I do but it does not show any error and I have no coordinates to compare with those in the logs |
Then, it could mean NATIVE_APP level tap action (nativeWebTap does the tap action in the NATIVE_APP context) succeeded, but the coordinate was wrong or Safari/browser content didn't get any events because of iOS internal something. Browser's tab bar affects the coordinate calculation, for example. Usually, coordinate info is in the appium server log such as appium-xcuitest-driver/lib/commands/web.js Line 746 in 08418ed
I thought such logs were in your appium server log as well. |
Thanks @KazuCocoa I missed this flag, a try and get back to you. |
@KazuCocoa What are the acceptable values of 'appium: nativeWebTapTabBarVisibility'? |
I have extracted this snippet from the log and what is interesting is 2025-01-20 10:42:14:308 - [XCUITestDriver@926c] tabBarPosition and topOffset: top, 95 |
Oh, sorry. My initial intention was
This means the element was If |
So safariTabBarPosition won't help either? Asking the Devs to add event logging is a long shot. Is there a way to highlight elements being clicked? |
|
This is the element :
could it be because this element does not have the button tag that the driver does not click/tap it? I pointed the click command to another element on the same page that had the |
I don't know since I have little knowledge of Web UI. It is how the Web App handles events rather than if Appium/WDA clicks a coordinate via XCTest framework (NATIVE_APP). |
As a work around , can you think of a way to highlight the position that is being clicked? |
I don't think my webapp is the issue, there is definitely something wrong with xcuitest - here is a generic use case to try: using w3school site to click on a paragraph that has a click event to change colour to red. On an android device the paragraph is clicked but not on the iOS device.
|
If the coordinate in Appium XCUITest driver was correct in the log but nothing happened, it could be XCTest framework internal or Safari engine related. If so, nothing could be done on the appium side, unfortunately. As Appium, we can tune up the coordination calculation only in this case. Android is via chromedriver. They work in different mechanisms. In terms of this, |
I understand please try to tune up the calculation , in the mean-time in order to spot if the correct element was being targeted - I have found a way to highlight the element using the below JS:
If you could add a flag that does this on the click coordinates, it could help with troubleshooting the clicks |
Update I have the iOS log and it seems to show the tap was at the xcuitest calculated coordinates, please have a look to see if I missed an error: |
Perhaps these are relevant logs about such a tap action. As they have
|
Thanks , the coordinates of the last tap corresponds with that in the appium logs and I saw no error messages in the rest of the iOS logs.All I have left is my button tag theory, I will modify the w3schools example to use a button as the click target instead of a paragraph and see if it works. |
After further investigation , I can conclude the following:
How many pixels below the target is variable but the coordinate calculations need to be tweaked. To help with trouble shooting by highlighting the target followed by the actual clicking of the target element I have have come up with the following script.
Usage:
|
version: 2.15.0
target environment: iOS
app: react
context: webView
devices: real mobiles
issue: calling the click() command on an element that is visible & clickable does not trigger the click event and does not throw any errors in the logs.
Having issues clicking on elements when using XCUITest in the capabilities, it was suggested to use the flag 'appium:nativeWebTap' and that worked for the 1st element but once the test moved to the next element the issue returned.
I Understand that coordinates calculated may be incorrect and that is the reason for the click event not being triggered but as there is no way to see the location where the click occurred - I cannot know for sure if the click happened.
A good way to troubleshoot would be to have a flag that highlights the element that was clicked, I have tried to write a script in the onCommand tag but that does not work:
`onCommand: async function (commandName, args) {
if (commandName === 'elementClick') { // also tried 'onClick' , 'click' , 'tap' , 'Click Element'
try {
const browser = global.broswer;
const element = await browser.$(args[0]);
Since I am only interested in the safari browser , it would be good to utilise the appium-safari-driver so that we could use it on a windows machine.
Any suggestions would be welcome.
The text was updated successfully, but these errors were encountered: