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 1.7.1 is stuck at [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities" #9645

Closed
shane51 opened this Issue Nov 16, 2017 · 48 comments

Comments

Projects
None yet
@shane51
Copy link

shane51 commented Nov 16, 2017

The problem

When upgraded into Appium 1.7.1, everytime app started by Appium in Simulator , I need to wait 2~6 mins to let test run. After check the Appium log, I found Appium paused at:

[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.***.****","arguments":[],"environment":{},"shouldWaitForQuiescence":true,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":true}}

after 6 mins, Appium get the following, and start to run

[debug] [JSONWP Proxy] Got response with status 200: {"value":{"sessionId":"396FCBB1-11DE-4C6D-8A07-751C97CEB2DC","capabilities":{"device":"iphone","browserName":null,"sdkVersion":"11.1","CFBundleIdentifier":null}},"sessionId":"396FCBB1-11DE-4C6D-8A07-751C97CEB2DC","status":0}

Environment

  • Appium version (or git revision) that exhibits the issue: 1.7.0, 1.7.1
  • Last Appium version that did not exhibit the issue (if applicable): 1.6.5 (no issues)
  • Desktop OS/version used to run Appium: Mac OS 10.12.6
  • Node.js version (unless using Appium.app|exe): v7.10.0
  • Mobile platform/version under test: iOS 11.0, 11.1, 10.3.1
  • Real device or emulator/simulator: simulator
  • Appium CLI or Appium.app|exe: CLI
  • Xcode version: 9.0, 9.1

Details

Currently, after app launched, I always need to wait 2~6 mins to let Appium responded, and start to run my test...

Appium 1.6.5 can run it without any issue. I think it should be introduced by 1.7.0 and after.

#9482 has the same issue, although the issue has been closed, she reproduced it again recently, cannot find a solution.

Great thanks!!

Link to Appium logs

https://gist.github.com/shane51/7fe7e0d5362647ee51d7eaa591cf36bc

Simulator logs:

https://gist.github.com/shane51/140a4f9556ecb5b9169354c348feed35

Code To Reproduce Issue [ Good To Have ]


    private void iOSCaps() {
        String IOS_APP_PATH = "/src/main/resources/*** - QA.app";
        File app = new File(System.getProperty("user.dir") + IOS_APP_PATH);
        capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS);
        capabilities.setCapability(MobileCapabilityType.FULL_RESET, true);
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, devicesUtils.IOS_DEVICE_NAME);
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, devicesUtils.SIMULATOR_VERSION);
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
        capabilities.setCapability(MobileCapabilityType.UDID, devicesUtils.SIMULATOR_UUID);
        capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
        capabilities.setCapability("bundleId", "com.***.qa2");
        capabilities.setCapability("useNewWDA", true);
        //you are free to set additional capabilities
    }

@mykola-mokhnach

This comment has been minimized.

Copy link
Collaborator

mykola-mokhnach commented Nov 16, 2017

Try to remove useNewWDA, bundleId, MobileCapabilityType.UDID and MobileCapabilityType.FULL_RESET capabilities

@shane51

This comment has been minimized.

Copy link
Author

shane51 commented Nov 17, 2017

I did a some research, and finally followed #9482 instruction from @imurchie as below:
image

After remove the above. the app cannot launch now..

Appium log

https://gist.github.com/shane51/c0a2228565de2f7d02c621a9a92e4967

@shane51

This comment has been minimized.

Copy link
Author

shane51 commented Nov 17, 2017

After I manually reset simulator, the app launched, but I still need to wait 5 mins to let test run, could you please advice is there a way to avoid it? or this is current XCUITest issue?

Great Thanks @mykola-mokhnach

Appium logs:

https://gist.github.com/shane51/8ca25b2bf99484b72ba85df945bb6feb

Simulator logs:

https://gist.github.com/shane51/781a6aeffa3de50e19de9b21edef1572

code:

  private void iOSCaps() {
        String IOS_APP_PATH = "/src/main/resources/**** - QA.app";
        File app = new File(System.getProperty("user.dir") + IOS_APP_PATH);
        capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.IOS);
//        capabilities.setCapability(MobileCapabilityType.FULL_RESET, true);
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, devicesUtils.IOS_DEVICE_NAME);
        capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, devicesUtils.SIMULATOR_VERSION);
        capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, "XCUITest");
//        capabilities.setCapability(MobileCapabilityType.UDID, devicesUtils.SIMULATOR_UUID);
        capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
//        capabilities.setCapability("bundleId", "com.****.qa2");
//        capabilities.setCapability("useNewWDA", true);
        //you are free to set additional capabilities
    }
@shane51

This comment has been minimized.

Copy link
Author

shane51 commented Nov 17, 2017

image

From the log, it shows XCUITest cost 5 mins to create and start wdaSession

@shane51

This comment has been minimized.

Copy link
Author

shane51 commented Nov 17, 2017

Hi @mykola-mokhnach when I monitored the test in CI, I found it stucked at the POST request mentioned above randomly, sometimes, it starts to run test while App launched, but sometimes it still wait 5~6 mins to let POST request get the response...then start to run test.

It's really annoying for continuously running the automation tests, every 2 or 3 cases, it stucks 5 mins...

@mykola-mokhnach mykola-mokhnach added ThirdParty and removed NotABug labels Nov 17, 2017

@mykola-mokhnach

This comment has been minimized.

Copy link
Collaborator

mykola-mokhnach commented Nov 17, 2017

To me it looks like either like XCTest or application under test issue. Appium just waits for WebDriverAgent to respond and WDA itself waits for the app to say that accessibility is ready.

@shane51

This comment has been minimized.

Copy link
Author

shane51 commented Nov 18, 2017

@mykola-mokhnach The app under test works fine with Appium 1.6.x for half a year.
This waiting issue came out after I upgrade Appium 1.6.5 to 1.7.0. When I downgrade to 1.6.5, it works fine. So it should related some changes in 1.7.0

@deedora

This comment has been minimized.

Copy link

deedora commented Nov 23, 2017

Did you manage to fix the problem?

@shane51

This comment has been minimized.

Copy link
Author

shane51 commented Nov 24, 2017

Not yet.... I'm consider using WebdriverAgent itself to see if the issue still persist...

@deedora

This comment has been minimized.

Copy link

deedora commented Nov 24, 2017

Ok. Let me know if you find the fix.

@alexttransisland

This comment has been minimized.

Copy link

alexttransisland commented Nov 25, 2017

When I downgraded to XCode 8.3.3 issue disappeared without magical capabilities. Just FYI as a workaround.

@OrRosenblatt

This comment has been minimized.

Copy link

OrRosenblatt commented Dec 13, 2017

We are experiencing the same issue (Appium v1.7.1, Xcode v9.1, Mac High Sierra OS).

Downgrading Xcode version is not an option for us since some things work only with the Xcode 9 (such as the latest version of homebrew or some pods).

Any idea how to fix?

@deedora

This comment has been minimized.

Copy link

deedora commented Dec 18, 2017

@mykola-mokhnach Can somebody look into this?

@alexttransisland

This comment has been minimized.

Copy link

alexttransisland commented Dec 18, 2017

The issue magicly disappeared for me after adding

    clearSystemFiles: true,
    wdaStartupRetryInterval: 1000,
    useNewWDA: true,
    waitForQuiescence: false,
    shouldUseSingletonTestManager: false

caps for Ruby. I didn't play around about what is optional, just a sum up after lurking through this and similar issues on internet.

@chrisjetstar

This comment has been minimized.

Copy link

chrisjetstar commented Dec 20, 2017

Issue is resolved with resolution from @alexttransisland
Thanks

@deedora

This comment has been minimized.

Copy link

deedora commented Dec 28, 2017

For me "waitForQuiescence: false" starts test before the app has started.

@tomkeiev

This comment has been minimized.

Copy link

tomkeiev commented Jan 9, 2018

I have the same issue as @deedora. Anyone knows how to solve the problem without settings 'waitForQuiescence' and 'useNewWDA' capabilities?

@alexttransisland

This comment has been minimized.

Copy link

alexttransisland commented Jan 9, 2018

Why can't you make a waiter until your app is launched?
something like

before do
  response =  Curl.get('http://localhost:8100/status') # not sure here what exact URL should be here, but something that waits for app initalization
  wait(300).until { Curl.get('http://localhost:8100/status').body_str }.eq('OK')
end

I mean you can programmatically check whatever Appium returns. (appium DOM, transport layer connection etc.)

@quintuschen

This comment has been minimized.

Copy link

quintuschen commented Jan 18, 2018

I have same problem, I tried to set the caps the same as @alexttransisland suggested. It worked for one time and when I tried to run the same case again, the problem is happening again.

We had test cases running all good for half a year with Xcode 8.3 and Appium 1.6.5 now we have to upgrade to Xcode 9 which means we have to use Appium 1.7+ then the problem emerges.

And this is observed using different clients like node.js and Python

@bayerjan

This comment has been minimized.

Copy link

bayerjan commented Feb 14, 2018

Got the same problem here. Using Java as a base technology, but virtually always takes long

@igorrfc

This comment has been minimized.

Copy link

igorrfc commented Feb 18, 2018

Same problem here =/ Does anyone figured out how to solve it?

@igorrfc

This comment has been minimized.

Copy link

igorrfc commented Feb 18, 2018

@alexttransisland's solution worked for me. Thanks a lot dude, I was struggling trying to fix this has been a while. 😅

@quintuschen

This comment has been minimized.

Copy link

quintuschen commented Feb 18, 2018

Hey @igorrfc, with @alexttransisland 's solution, do your cases always run? For my case sometimes it runs smoothly but sometimes it still stuck.

@igorrfc

This comment has been minimized.

Copy link

igorrfc commented Feb 19, 2018

Hey @quintuschen, after add the suggested configs I have stable tests. Actually, I'm integrating the appium on my project, so I don't have many test cases. After you asked me this, I tried to add more tests, and the suite still running well. Would you like to know my environment specs or something like that? Just let me know :)

@quintuschen

This comment has been minimized.

Copy link

quintuschen commented Feb 19, 2018

Hey @igorrfc If you could share some of your environment specs that would be awesome. My test cases are running well on Appium 1.6.5 and Xcode 8.3 but now it is very unstable. On Android it runs fine but iOS it often stuck at this stage.

@auto-mator

This comment has been minimized.

Copy link

auto-mator commented Feb 26, 2018

Any official solution to this issue? I need to be able to automate iOS 11.x the same way I am able to automate 10.3.3, and it just does not work. If I have noReset = true, all testing is fine, but I cannot uninstall and reinstall the app because the Profile is no longer trusted within General > Profiles on the device. Why is this?

@bayerjan

This comment has been minimized.

Copy link

bayerjan commented Feb 26, 2018

Hi @auto-mator This should actually be a new ticket since it is a separate issue
If I am not mistaken as long as one app with the profile (trusted) is kept on the device it will work. As soon as the last app is uninstalled then one needs to re-trust the profile.
Coming to think of it, how would this be solved on a simulator? Is trusting necessary?

@auto-mator

This comment has been minimized.

Copy link

auto-mator commented Feb 26, 2018

That's a good point...that may work as a work-around. But why doesn't this work on iOS 11 in general, but is fine for iOS 10? I have no issues with maintaining trust when no reset is false on iOS 10

@auto-mator

This comment has been minimized.

Copy link

auto-mator commented Mar 25, 2018

Sure enough, your idea worked perfectly Bayerjan! Thank you

@jesushebra

This comment has been minimized.

Copy link

jesushebra commented Apr 5, 2018

Unfortunately, I have exactly the same problem working with newer versions that all those presented at the problem description of this issue. I work with Xcode 9.2 and I have checked that happens with these Appium versions: 1.7.0, 1.7.1, 1.7.2 and 1.8.0-beta.

This is an extract of my Appium logs. Once the app has been installed into a simulator/device, next logs are recurrent and it is impossible to run my own test cases:
...
[debug] [XCUITest] Sending createSession command to WDA
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.xxx.yyy","arguments":[],"environment":{},"shouldWaitForQuiescence":false,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":false}}
[debug] [JSONWP Proxy] Got response with status 200: {"value":"Failed to launch com.accenture.carrefour-cuali application","sessionId":"49A826C6-A2D8-42FF-9347-9F1FF994BF7B","status":13}
[debug] [XCUITest] Failed to create WDA session. Retrying...
[debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1522924456876 (12:34:16 GMT+0200 (CEST))
[debug] [XCUITest] Sending createSession command to WDA
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.xxx.yyy","arguments":[],"environment":{},"shouldWaitForQuiescence":false,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":false}}
[HTTP] <-- POST /wd/hub/session - - ms - -
[HTTP]
[debug] [JSONWP Proxy] Got response with status 200: {"value":"Failed to launch com.xxx.yyy application","sessionId":"49A826C6-A2D8-42FF-9347-9F1FF994BF7B","status":13}
[debug] [XCUITest] Failed to create WDA session. Retrying...
[debug] [BaseDriver] Event 'wdaSessionAttempted' logged at 1522924639155 (12:37:19 GMT+0200 (CEST))
[debug] [XCUITest] Sending createSession command to WDA
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://localhost:8100/session] with body: {"desiredCapabilities":{"bundleId":"com.xxx.yyy","arguments":[],"environment":{},"shouldWaitForQuiescence":false,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":false}}
...

These are all capabilities I have configured, according to previous comments:
capabilities.setCapability("deviceName", "iPhone 6");
capabilities.setCapability("platformName","iOS");
capabilities.setCapability("platformVersion", "11.2");
capabilities.setCapability("automationName", "XCUITest");
capabilities.setCapability("clearSystemFiles", true);
capabilities.setCapability("wdaStartupRetryInterval", 1000);
capabilities.setCapability("useNewWDA", true);
capabilities.setCapability("waitForQuiescence", false);
capabilities.setCapability("shouldUseSingletonTestManager", false);
capabilities.setCapability("showXcodeLog", true);
capabilities.setCapability("app", binaryFile.getAbsolutePath());

I can't come back to previous versions of Appium because I need Xcode 9 for my project. I don't find the solution to the problem. Could someone help me, please?

Thanks in advance.

@quintuschen

This comment has been minimized.

Copy link

quintuschen commented Apr 5, 2018

@jesushebra, we have been battling this issue for quite a while but we do not find the root cause. However, this might be a workaround that you could give a try. The cases won't run on my old Mac until I upgraded to a more powerful, better CPU and most importantly an SSD. Then with same settings and the same suite, they run smoothly, which makes me suspect the original problem is due to the hard disk was actually too slow to initiate the tests and it is too slow for WDA to launch. Just my guess I have no proof of that though.

@jesushebra

This comment has been minimized.

Copy link

jesushebra commented Apr 6, 2018

@quintuschen, thank you very much for your answer. I use a MacBook Pro with next properties:
SO: macOS High Sierra v10.13.3
Id: MacBookPro14,1
Processor: 2,3 GHz Intel Core i5
Memory: 8 GB 2133 MHz LPDDR3
Graphics: Intel Iris Plus Graphics 640 1536 MB

Do you think it's normal I have problems with this computer? I purchased it last month.
Thanks again

@quintuschen

This comment has been minimized.

Copy link

quintuschen commented Apr 8, 2018

@jesushebra Does it come with SSD? New computer should be fast though. Anyway that was only my theory. My problem was 'solved' by changing to a new Mac.

@deedora

This comment has been minimized.

Copy link

deedora commented Apr 9, 2018

I don't think that is the only solution. My problem disappeared after I've removed every possible trace of appium from my mac and updated to 1.7.2. Also, try to remove the app you are testing, rebuild it and then install it.

@jesushebra

This comment has been minimized.

Copy link

jesushebra commented Apr 9, 2018

@quintuschen, yes, it comes with SSD (Apple SDD SM0128L). In fact, it is a powerful Mac. However, your solution does not work for me.
@deedora, what do you mean by "I've removed every possible trace of appium from my mac"? I have uninstalled Appium and installed again (v1.7.2). I've also removed the app. However, the problem continues

@deedora

This comment has been minimized.

Copy link

deedora commented Apr 9, 2018

Search for appium in the finder. There is probably some files or folders left after you uninstall the app.

@jesushebra

This comment has been minimized.

Copy link

jesushebra commented Apr 9, 2018

@deedora, I've uninstalled appium, I've deleted all files and folders and I've installed appium again. However, the problem persists (even if I rebuild the app). The situation starts to be frustrating

@zcmgyu

This comment has been minimized.

Copy link

zcmgyu commented Apr 21, 2018

useNewWDA: true
clearSystemFiles: true

It works for me.

@marlon641

This comment has been minimized.

Copy link

marlon641 commented Apr 30, 2018

Did anyone find a solution to this problem? I have a brand new macbook pro, latest appium desktop and appium, have set the suggested caps, but I still hang exactly where everyone else does.

...
{},"shouldWaitForQuiescence":false,"shouldUseTestManagerForVisibilityDetection":false,"maxTypingFrequency":60,"shouldUseSingletonTestManager":false}}

@Pr60

This comment has been minimized.

Copy link

Pr60 commented May 1, 2018

Even I'm facing this issue. Any updates on this one?

@jpita

This comment has been minimized.

Copy link

jpita commented Jun 13, 2018

Appium 1.8
xcode 9.4

capabilities.setCapability("waitForQuiescence", false) capabilities.setCapability("useNewWDA", true) capabilities.setCapability("shouldUseSingletonTestManager", false) capabilities.setCapability("clearSystemFiles", true) capabilities.setCapability("shouldUseTestManagerForVisibilityDetection", true)

still have the issue...
It's weird, it opens and closes the app 3 times and then just hangs...

chamitha added a commit to teamapp/appium-tests that referenced this issue Sep 5, 2018

@NiveditaSachan

This comment has been minimized.

Copy link

NiveditaSachan commented Sep 18, 2018

@jpita I am also facing the same issue. it opens and closes the app 3 times and then just hangs. DId you find any workaround ?

@jpita

This comment has been minimized.

Copy link

jpita commented Sep 18, 2018

@NiveditaSachan no, I quit on automating on iOS for now.
If I have time I'll get back to it, if I keep on having issues I'll try to automate with the native framework, XCUItest

@NiveditaSachan

This comment has been minimized.

Copy link

NiveditaSachan commented Sep 18, 2018

@jpita Thanks for responding. It worked for me when I used Simulator build to inspect elements of my native iOS app.

@krishna8181

This comment has been minimized.

Copy link

krishna8181 commented Nov 26, 2018

thank you so much guys, i have managed to fix the issue using solution proposed by @alexttransisland. making some good progress

@Marrowbones

This comment has been minimized.

Copy link

Marrowbones commented Dec 12, 2018

In case anyone is still having the same problem, try upgrading everything (NPM, Appium, etc); I know it sounds obvious, but what's probably happened is that you've installed an OS upgrade that's not compatible with some component of the Appium/WebDriver setup. For me, the problem was carthage (brew update carthage) - an easy one to overlook. Hope this helps.

@chaotive

This comment has been minimized.

Copy link

chaotive commented Dec 19, 2018

I have this very same issue, as I reported it back again on this ticket: #11864

@hangyumao

This comment has been minimized.

Copy link

hangyumao commented Jan 10, 2019

@jpita I am also facing the same issue. it opens and closes the app 3 times and then just hangs. DId you find any workaround ?

hello, have you resolved this problem?

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