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 issue with chrome session on real device #9607

Closed
automation311 opened this Issue Nov 8, 2017 · 27 comments

Comments

Projects
None yet
3 participants
@automation311

automation311 commented Nov 8, 2017

The problem

The Chrome browser opens and not responding and stays still

[debug] [JSONWP Proxy] Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"10.0.15063\"}}}"
[debug] [JSONWP Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"a2573096"}}}
[debug] [Chromedriver] Webview version: 'Chrome/61.0.3163.98'

and then throws the following error:

[Chromedriver] Chromedriver exited unexpectedly with code null, signal SIGTERM
[debug] [Chromedriver] Changed state to 'stopped'
[Chromedriver] Error: unknown error: Device axxxxx is already in use

Environment

  • Appium version (or git revision) that exhibits the issue:1.7.1
  • Last Appium version that did not exhibit the issue (if applicable):
  • Desktop OS/version used to run Appium:Windows
  • Node.js version (unless using Appium.app|exe):v8.9.0
  • Mobile platform/version under test: Android 6.0.1/ Chrome/61.0.3163.98
  • Real device or emulator/simulator: real device
  • Appium CLI or Appium.app|exe:

Details

If necessary, describe the problem you have been experiencing in more detail.

Link to Appium logs

https://gist.github.com/automation311/617c31456e924ea70c15059c6ffdbb34

Code To Reproduce Issue [ Good To Have ]

   @Test
        public void test() throws MalformedURLException, InterruptedException {
              AppiumDriver driver;

            DesiredCapabilities capabilities = DesiredCapabilities.android();

            capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, BrowserType.CHROME);

            capabilities.setCapability(MobileCapabilityType.PLATFORM, Platform.ANDROID);

            capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME , "Android");

             capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "my phone");

             capabilities.setCapability (MobileCapabilityType.VERSION, "6.0.1");

            URL url = new URL("http://0.0.0.0:4723/wd/hub");

            driver = new AndroidDriver(url,capabilities);
}
@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 8, 2017

Member

Can you add the showChromedriverLog desired capability, set to true, and repost the Appium server logs (which ought to include now the Chromedriver logs) as a link to a gist?

Member

imurchie commented Nov 8, 2017

Can you add the showChromedriverLog desired capability, set to true, and repost the Appium server logs (which ought to include now the Chromedriver logs) as a link to a gist?

@automation311

This comment has been minimized.

Show comment
Hide comment
@automation311

automation311 commented Nov 8, 2017

@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

Hmm. Yes, that looks wrong. It connects once but then retries the session startup.

Member

imurchie commented Nov 9, 2017

Hmm. Yes, that looks wrong. It connects once but then retries the session startup.

@imurchie imurchie added the Bug label Nov 9, 2017

@automation311

This comment has been minimized.

Show comment
Hide comment
@automation311

automation311 Nov 9, 2017

Is this a known issue or am i doing something wrong?

automation311 commented Nov 9, 2017

Is this a known issue or am i doing something wrong?

@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

@automation311 I've updated the logging of session start to get what is happening (hopefully). Can you update Appium (npm uninstall -g appium && npm install -g appium@beta) to get appium-chromedriver@3.1.2, and then rerun? The error will still happen but hopefully we'll have more to go on.

Member

imurchie commented Nov 9, 2017

@automation311 I've updated the logging of session start to get what is happening (hopefully). Can you update Appium (npm uninstall -g appium && npm install -g appium@beta) to get appium-chromedriver@3.1.2, and then rerun? The error will still happen but hopefully we'll have more to go on.

@automation311

This comment has been minimized.

Show comment
Hide comment
@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

Can you make sure it actually gets to the chromedriver start? This error is that the device is not connected.

Member

imurchie commented Nov 9, 2017

Can you make sure it actually gets to the chromedriver start? This error is that the device is not connected.

@automation311

This comment has been minimized.

Show comment
Hide comment
@automation311

automation311 Nov 9, 2017

The device is connected. initially it says 1 device connected. but then it says 0 devices connected and fails right away. Let me try again.

automation311 commented Nov 9, 2017

The device is connected. initially it says 1 device connected. but then it says 0 devices connected and fails right away. Let me try again.

@automation311

This comment has been minimized.

Show comment
Hide comment
@automation311

automation311 Nov 9, 2017

I think there is an issue in appium@beta. I tried killing the adb . still shows 0 devices connected.

I tried uninstallling the beta and installing appium1.7.1. and ran my test this takes me to the chrome browser. but not responding as I said before.

automation311 commented Nov 9, 2017

I think there is an issue in appium@beta. I tried killing the adb . still shows 0 devices connected.

I tried uninstallling the beta and installing appium1.7.1. and ran my test this takes me to the chrome browser. but not responding as I said before.

@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

Hmm. I'll take a look at that.

In the meantime, can you update just appium-chromedriver? Go into your Appium installation and run npm install appium-chromedriver?

Member

imurchie commented Nov 9, 2017

Hmm. I'll take a look at that.

In the meantime, can you update just appium-chromedriver? Go into your Appium installation and run npm install appium-chromedriver?

@automation311

This comment has been minimized.

Show comment
Hide comment
@automation311

automation311 commented Nov 9, 2017

sure

@automation311

This comment has been minimized.

Show comment
Hide comment
@automation311

automation311 Nov 9, 2017

do you want me to update chromedriver for appium 1.7.1 or appium@beta?

automation311 commented Nov 9, 2017

do you want me to update chromedriver for appium 1.7.1 or appium@beta?

@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

For the working Appium. 1.7.1 I guess. Just to get the latest chromedriver logging.

Member

imurchie commented Nov 9, 2017

For the working Appium. 1.7.1 I guess. Just to get the latest chromedriver logging.

@automation311

This comment has been minimized.

Show comment
Hide comment
@automation311

automation311 Nov 9, 2017

I ran npm install appium-chromedriver

heapdump@0.3.9 install C:\Users\node_modules\heapdump
node-gyp rebuild

C:\Users\node_modules\heapdump>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\node_modules\heapdump
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

appium-chromedriver@3.1.2 install C:\Users\node_modules\appium-chromedriver
node install-npm.js

info Chromedriver Install Installing Chromedriver version '2.33' for platform 'win' and architecture '32'
info Chromedriver Install Opening temp file to write chromedriver_win32 to...
info Chromedriver Install Downloading https://chromedriver.storage.googleapis.com/2.33/chromedriver_win32.zip...
info Chromedriver Install Writing binary content to C:\Users\AppData\Local\Temp\2017109-21696-qr5d2k.zagqo\chromedriver_win32.zip...
info Chromedriver Install Extracting C:\Users\AppData\Local\Temp\2017109-21696-qr5d2k.zagqo\chromedriver_win32.zip to C:\Users\AppData\Local\Temp\2017109-21696-qr5d2k.zagqo\chromedriver_win32
info Chromedriver Install Creating C:\Users\node_modules\appium-chromedriver\chromedriver\win...
info Chromedriver Install Copying unzipped binary, reading from C:\Users\AppData\Local\Temp\2017109-21696-qr5d2k.zagqo\chromedriver_win32\chromedriver.exe...
info Chromedriver Install Writing to C:\Users\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe...
info Chromedriver Install C:\Users\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe successfully put in place
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\package.json'
npm WARN No description
npm WARN No repository field.
npm WARN No README data
npm WARN No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: heapdump@0.3.9 (node_modules\heapdump):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: heapdump@0.3.9 install: node-gyp rebuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

  • appium-chromedriver@3.1.2
    added 116 packages and updated 1 package in 17.519s

Is this how it will install? I am not sure how to install . But when i run my test i still see chromedriver 2.30 started

automation311 commented Nov 9, 2017

I ran npm install appium-chromedriver

heapdump@0.3.9 install C:\Users\node_modules\heapdump
node-gyp rebuild

C:\Users\node_modules\heapdump>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\node_modules\heapdump
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

appium-chromedriver@3.1.2 install C:\Users\node_modules\appium-chromedriver
node install-npm.js

info Chromedriver Install Installing Chromedriver version '2.33' for platform 'win' and architecture '32'
info Chromedriver Install Opening temp file to write chromedriver_win32 to...
info Chromedriver Install Downloading https://chromedriver.storage.googleapis.com/2.33/chromedriver_win32.zip...
info Chromedriver Install Writing binary content to C:\Users\AppData\Local\Temp\2017109-21696-qr5d2k.zagqo\chromedriver_win32.zip...
info Chromedriver Install Extracting C:\Users\AppData\Local\Temp\2017109-21696-qr5d2k.zagqo\chromedriver_win32.zip to C:\Users\AppData\Local\Temp\2017109-21696-qr5d2k.zagqo\chromedriver_win32
info Chromedriver Install Creating C:\Users\node_modules\appium-chromedriver\chromedriver\win...
info Chromedriver Install Copying unzipped binary, reading from C:\Users\AppData\Local\Temp\2017109-21696-qr5d2k.zagqo\chromedriver_win32\chromedriver.exe...
info Chromedriver Install Writing to C:\Users\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe...
info Chromedriver Install C:\Users\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe successfully put in place
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\package.json'
npm WARN No description
npm WARN No repository field.
npm WARN No README data
npm WARN No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: heapdump@0.3.9 (node_modules\heapdump):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: heapdump@0.3.9 install: node-gyp rebuild
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

  • appium-chromedriver@3.1.2
    added 116 packages and updated 1 package in 17.519s

Is this how it will install? I am not sure how to install . But when i run my test i still see chromedriver 2.30 started

@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

Is c:\Users where you have Appium installed? You need to be in the Appium installation directory (where this is depends on the machine).

Member

imurchie commented Nov 9, 2017

Is c:\Users where you have Appium installed? You need to be in the Appium installation directory (where this is depends on the machine).

@automation311

This comment has been minimized.

Show comment
Hide comment
@automation311

automation311 Nov 9, 2017

Got it. Thanks. now i have chromedriver 2.33. when i run my test it shows started 2.33.

automation311 commented Nov 9, 2017

Got it. Thanks. now i have chromedriver 2.33. when i run my test it shows started 2.33.

@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

Does the same problem happen?

Member

imurchie commented Nov 9, 2017

Does the same problem happen?

@automation311

This comment has been minimized.

Show comment
Hide comment
@automation311

automation311 Nov 9, 2017

yes. the browser gets opened but nothing happens.

automation311 commented Nov 9, 2017

yes. the browser gets opened but nothing happens.

@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

Ok. Hopefully the logs give some elucidation.

Member

imurchie commented Nov 9, 2017

Ok. Hopefully the logs give some elucidation.

@automation311

This comment has been minimized.

Show comment
Hide comment
@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

Hmm. That didn't add anything. It also doesn't look like what the update should look like.

Could you try once again? When run I would expect logs of the sort:

dbug JSONWP Proxy Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","args":["--no-first-run"],"androidDeviceSerial":"ZX1G22C7KW"}}}
ERR! Chromedriver [STDERR] [0.044][INFO]: COMMAND InitSession {
ERR! Chromedriver [STDERR]    "desiredCapabilities": {
ERR! Chromedriver [STDERR]       "chromeOptions": {
ERR! Chromedriver [STDERR]          "androidDeviceSerial": "ZX1G22C7KW",
ERR! Chromedriver [STDERR]          "androidPackage": "com.android.chrome",
ERR! Chromedriver [STDERR]          "args": [ "--no-first-run" ]
ERR! Chromedriver [STDERR]       }
ERR! Chromedriver [STDERR]    }
ERR! Chromedriver [STDERR] }

Rather than without the prefix as in your logs (I updated this at the same time as the error handling).

The appium-chromedriver version ought to be 3.1.3 when you update now (you can, after doing the install, try running npm ls appium-chromedriver to see the version).

Member

imurchie commented Nov 9, 2017

Hmm. That didn't add anything. It also doesn't look like what the update should look like.

Could you try once again? When run I would expect logs of the sort:

dbug JSONWP Proxy Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","args":["--no-first-run"],"androidDeviceSerial":"ZX1G22C7KW"}}}
ERR! Chromedriver [STDERR] [0.044][INFO]: COMMAND InitSession {
ERR! Chromedriver [STDERR]    "desiredCapabilities": {
ERR! Chromedriver [STDERR]       "chromeOptions": {
ERR! Chromedriver [STDERR]          "androidDeviceSerial": "ZX1G22C7KW",
ERR! Chromedriver [STDERR]          "androidPackage": "com.android.chrome",
ERR! Chromedriver [STDERR]          "args": [ "--no-first-run" ]
ERR! Chromedriver [STDERR]       }
ERR! Chromedriver [STDERR]    }
ERR! Chromedriver [STDERR] }

Rather than without the prefix as in your logs (I updated this at the same time as the error handling).

The appium-chromedriver version ought to be 3.1.3 when you update now (you can, after doing the install, try running npm ls appium-chromedriver to see the version).

@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

Alternatively, retry with appium@beta. The error in your logs is also present in one of your 1.7.1 logs (see logs in #9607 (comment)).

Member

imurchie commented Nov 9, 2017

Alternatively, retry with appium@beta. The error in your logs is also present in one of your 1.7.1 logs (see logs in #9607 (comment)).

@automation311

This comment has been minimized.

Show comment
Hide comment

automation311 commented Nov 9, 2017

@automation311

This comment has been minimized.

Show comment
Hide comment
@automation311

automation311 Nov 9, 2017

i have the latest chrome driver but my version is displayed as 3.1.2. not sure why.

Can i install the chrome driver by specifying chromedriver version variable?

npm install -g appium --chromedriver_version="2.16"

npm install -g appium --chromedriver_version="LATEST"

automation311 commented Nov 9, 2017

i have the latest chrome driver but my version is displayed as 3.1.2. not sure why.

Can i install the chrome driver by specifying chromedriver version variable?

npm install -g appium --chromedriver_version="2.16"

npm install -g appium --chromedriver_version="LATEST"

@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

The chromedriver version and the appium-chromedriver version are different tings. npm install -g appium@beta will update the latter, as will npm install -g appium --no-shrinkwrap.

Member

imurchie commented Nov 9, 2017

The chromedriver version and the appium-chromedriver version are different tings. npm install -g appium@beta will update the latter, as will npm install -g appium --no-shrinkwrap.

@imurchie

This comment has been minimized.

Show comment
Hide comment
@imurchie

imurchie Nov 9, 2017

Member

A different thing to try... can you manually start Chromedriver in a terminal window:

C:\Users\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=8000 --adb-port=5037 --verbose

And then, in another terminal window try to start a Chromedriver session (put in your device id):

curl -X POST -H "Content-Type: application/json" -d "{\"desiredCapabilities\":{\"chromeOptions\":{\"androidPackage\":\"com.android.chrome\",\"androidDeviceSerial\":\"<YOUR SERIAL NUMBER>\"}}}" http://127.0.0.1:8000/wd/hub/session

Perhaps we can see what is going wrong then?

Member

imurchie commented Nov 9, 2017

A different thing to try... can you manually start Chromedriver in a terminal window:

C:\Users\AppData\Roaming\npm\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win\chromedriver.exe --url-base=wd/hub --port=8000 --adb-port=5037 --verbose

And then, in another terminal window try to start a Chromedriver session (put in your device id):

curl -X POST -H "Content-Type: application/json" -d "{\"desiredCapabilities\":{\"chromeOptions\":{\"androidPackage\":\"com.android.chrome\",\"androidDeviceSerial\":\"<YOUR SERIAL NUMBER>\"}}}" http://127.0.0.1:8000/wd/hub/session

Perhaps we can see what is going wrong then?

@mykola-mokhnach

This comment has been minimized.

Show comment
Hide comment
@mykola-mokhnach

mykola-mokhnach Sep 4, 2018

Collaborator

Closed as inactive

Collaborator

mykola-mokhnach commented Sep 4, 2018

Closed as inactive

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