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

[Bug]: Appium iOS Driver Returns Unexpected Context Values During Automation #841

Open
Sarmad-Saleem-SS opened this issue Oct 8, 2024 · 14 comments

Comments

@Sarmad-Saleem-SS
Copy link

I am experiencing an issue with the Appium iOS Driver where the contexts returned during webview automation are incorrect. Despite the Appium server logs showing valid context values, my automation scripts are receiving unexpected strings, specifically "System.Collections.Generic.Dictionary`2[System.String,System.Object]" instead of the expected webview context IDs.

And in server logs

[61112fad][XCUITestDriver@edc5] Responding to client with driver.getContexts() result: [{"id":"NATIVE_APP"},{"id":"WEBVIEW_18156.1","title":"Floor Plan","url":"https://devapp.nfsonline.net/AutomationFP/?AppUserId=0eb8c8cb-5a70-4bca-8739-74881854ee90&Source=mobile&Functionality=floorplan&Platform=flutter","bundleId":"com.nfs.mobile"}]

@Sarmad-Saleem-SS
Copy link
Author

@Dor-bl

@Dor-bl
Copy link
Collaborator

Dor-bl commented Oct 9, 2024

@SarmadSaleeem can you please share the appium version you are using? Both server and the client.
Also the xcuitest driver version might help.

@Sarmad-Saleem-SS
Copy link
Author

@Dor-bl
Appium Server: 2.11.5
XCuitTest: 5.16.1
Appium Client: 4.4.5

@Sarmad-Saleem-SS
Copy link
Author

I am testing on ios 16.0 simulator.

@Dor-bl
Copy link
Collaborator

Dor-bl commented Oct 9, 2024

@SarmadSaleeem we no longer support appium client 4.x.y

Please update to version 5.x.y and try again

@Sarmad-Saleem-SS
Copy link
Author

Sarmad-Saleem-SS commented Oct 9, 2024

@Dor-bl I updated to latest version and fixed all the code issues. Now When I try to run I get this error

"'automationName' can't be blank"

Capability using
appiumOptions.AddAdditionalAppiumOption("AutomationName", "xcuitest");

Server log:
[Appium] Could not parse W3C capabilities: 'automationName' can't be blank

@Dor-bl
Copy link
Collaborator

Dor-bl commented Oct 9, 2024

Appium options already has the automationName property.
Just use it directly

@Sarmad-Saleem-SS
Copy link
Author

Sarmad-Saleem-SS commented Oct 9, 2024

image

@Dor-bl Still getting the same issue. Not able to get the WebView.

var context = driver.Context;
MyLogger.Info($"current view is {driver.Context}");
ReadOnlyCollection < string > allContexts = driver.Contexts;

context is returning "Native app"
contexts returning list of these strings
[0] "System.Collections.Generic.Dictionary`2[System.String,System.Object]"

[1] "System.Collections.Generic.Dictionary`2[System.String,System.Object]"

@Dor-bl
Copy link
Collaborator

Dor-bl commented Oct 9, 2024

So it might be a bug, I'll try to have a look at some point in the next few days

@Sarmad-Saleem-SS
Copy link
Author

@Dor-bl

This is what I am getting in IOS appium inspector
image

And this in Android appium inspector

image

@Sarmad-Saleem-SS
Copy link
Author

Sarmad-Saleem-SS commented Oct 9, 2024

@Dor-bl I updated my IOS simulator to 16.4

Now On appium inspector I am getting all the contexts

image

but in code still having the same issue.

@Sarmad-Saleem-SS
Copy link
Author

The issue is solved now. I was using some additional capabilities. Now I removed all of them and left with only the required ones. Now I am able to get the correct values. Maybe some capability was causing the issue.

Thank you so much @Dor-bl for your assistance.

@Dor-bl
Copy link
Collaborator

Dor-bl commented Oct 9, 2024

Good to hear.
If you could pinpoint the capability that cause this issue, it will be great for future users.

@Sarmad-Saleem-SS
Copy link
Author

Ok I will try to figure out which capability was causing the issue. Then will update here.

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

No branches or pull requests

2 participants