Tag Archives: appium

[Solved] appium Error: An unknown server-side error occurred while processing the command

Error Messages:

UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not proxy command to the remote server. Original error: socket hang up

Solution:
Close/uninstall the service

adb uninstall io.appium.settings

adb uninstall io.appium.uiautomator2.server.test
     
adb uninstall io.appium.uiautomator2.server  

Re execution, automatic installation

[Solved] appium Error: Original error: socket hang up

App automation error reporting and appium error reporting:

Encountered internal error running command: UnknownError: An unknown server-side error occurred while processing the command.original error: Could not proxy command to the remote server.original error: socket hang up

Solution:
uninstall appium setting and other appium installed apps on the device, uninstall the automatically started app (operation object APK), and restart the device

[Solved] selenium.common.exceptions.WebDriverException: Message: An unknown server-side error

Error code

from appium import webdriver
from selenium.webdriver.support.ui import WebDriverWait

desired_caps={}
desired_caps['platformName']='Android'
desired_caps['platformVersion']='7.1.2'
desired_caps['deviceName']='127.0.0.1:21503'

desired_caps['app']=r'D:\appium_app\dr.fone3.2.0.apk'
desired_caps['appPackage']='com.wondershare.drfone'
desired_caps['appActivity']='com.wondershare.drfone.ui.activity.WelcomeActivity'

# Port
driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
driver.implicitly_wait(3)

driver.find_element_by_id('com.wondershare.drfone:id/btnBackup').click()

WebDriverWait(driver,15).until(lambda x:x.find_element_by_class_name('android.widget.Button'))
driver.find_element_by_class_name('android.widget.Button').click()

WebDriverWait(driver,8).until(lambda x:x.find_element_by_android_uiautomator('new UiSelector().text("Refresh")'))
driver.find_element_by_android_uiautomator('new UiSelector().text("Refresh")').click()


WebDriverWait(driver,8).until(lambda x:x.find_element_by_class_name('android.webkit.WebView'))
contexts=driver.contexts
print(contexts)

driver.switch_to.context('WEBVIEW_com.wondershare.drfone')
driver.find_element_by_id('email').send_keys('[email protected]')
driver.find_element_by_class_name('btn_send').click()

driver.switch_to.context('NATIVE_APP')
driver.find_element_by_class_name('android.widget.ImageButton').click

Error Messages:
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: No Chromedriver found that can automate Chrome '68.0.3440'. You could also try to enable automated chromedrivers download server feature. See https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/web/chromedriver.md for more details

Solution:

own local appium server without chromedriver.exe configured
Configure chromedriver.exe
Try to ensure that the emulator version and the PC version of the same download
## Replace or Save chromedriver.exe
Default path:
C:\Users\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win Replace chromedrive to the original one.
My installation path
C:\Users\yunao\node_modules\appium-chromedriver\chromedriver\win

Appium Top 10 Common Error [How to Solve]

(1) Appium service is not started

[error message] urllib.error.urlerror: & lt; Urlopen error [winerror 10061] unable to connect because the target computer actively refused.

[solution] after clicking the start appium button, the [appium] welcome to appium v1.7.2 prompt appears, and then run the script

(2) Session conflict

Error: failed to start an appium session, err was: error: requested a new session but one was in progress

[solution] restart the appium service, start the appium service, check the allow session override option in the advanced interface, restart the appium test, and add driver. Quit() in afterclass at the end of the test

(3) Device not connected

[error message] selenium. Common. Exceptions. Webdriverexception: Message: an unknown server side error occurred while processing the command. Original error: could not find a connected Android device

[solution] ADB ensure that the device is connected

(4) Java not installed or version problem

[error message] selenium.common.exceptions.webdriverexception: Message: a new session could not be created. (original error: ‘Java – version’ failed. Error: command failed: C: \ windows \ system32 \ cmd.exe/S/C “Java – version”“

[solution] check Java environment variables

(5) The launchable activity value is written incorrectly

[error message] activity used to start app doesn’t exist or cannot be launched! Make sure it exists and is a launching activity

[solution]  correct the misspelling of launch activity.

(6) System permission problem

[error message] failure [install_failed_user_restricted])

[solution] 1. USB installation management permission limit. Just close it. 2. Turn on the option to allow unknown source app installation

(7) Appium service exception

[error message] an unknown server side error occurred while processing the command “while opening the app

[solution] restart appium service

(8) JRE environmental issues

[error message] are you sure you have installed JDK/JRE?

[solution] check whether there is JRE in the same level directory of JDK, and check the environment variable configuration of JDK

(9) Android SDK environment

[error message] no such file or directory “E: \ android_sdk”

[solution] check the environment variable configuration of Android SDK, especially android_home

(10) Uiautomator error

[error message] uiautomator version is too low/high

[solution] add “automationname”: “uiautomator2” to the capability configuration information

When the MAC M1 uiautomatorviewer is opened, it displays blank or reports an error

As shown in the following figure: uiautomatorviewer displays blank

Cause: the problem of java version is too new

➜  sdk  ls /Library/Java/JavaVirtualMachines/
jdk1.8.0_161.jdk zulu-17.jdk

Solution: downgrade

The Java version can be downgraded to before 201 or before 51. (the blogger’s 161 failed, which may also be the reason for the M1 chip)
uiautomatorviewer is actually a Java startup script. For example, you can use this command on the Mac to see the real startup command.

bash -x /Users/zhoujing/Library/Android/sdk/tools/bin/uiautomatorviewer

In order to ensure that the uiautomatorviewer can run correctly locally, several jdks can be standby

Link to download old java version: SDK

References:
1. Error reporting after uiautomatorviewer is opened under MAC
2. Learning experience of MAC Android automatic test

Mac Appium Error: Error executing adb Exec. Original error…

Appium error on MAC, error executing ADB exec. Original error

Error message: error executing adbexec. Original error: ‘command’/users/noogler/library/Android/SDK/platform tools/ADB – P 5037 – s clb7n18528000446 shell ‘settings delete global hidden_ api_ policy_ pre_ p_ apps; settings delete global hidden_ api_ policy_ p_ apps; settings delete global hidden_ api_ policy” exited with code 1

Process summary

Error information

: Error executing adbExec. Original error: ‘Command ‘/Users/noogler/Library/Android/sdk/platform-tools/adb -P 5037 -s CLB7N18528000446 shell ‘settings delete global hidden_ api_ policy_ pre_ p_ apps; settings delete global hidden_ api_ policy_ p_ apps; settings delete global hidden_ api_ policy’’ exited with code 1

Process

After clicking the start session button in appium, you can enter the page without screenshot and throw an error. After a long time in Google, stackworkflow, CSDN and GitHub failed to solve the problem for a long time. After updating the bundle tools of Android studio to the Android 11 version, it still has no effect. The SDK version of Android studio has 29 30 31. The Android device version connected to the computer is 10. The calling of the third-party Android SDK has been modified, but there is no solution.

adb shell settings put global hidden_ api_ policy_ p_ apps 1
*adb shell settings put global hidden_ api_ policy_ pre_ p_ Apps 1 reduces the version of appium desktop from 1.21 to 1.17!! So I tried to use version 1.21 on another iMac, and it also started successfully! The result of appium doctor is that all required and optional are installed. The Java SDK version is also 1.8. Try to find the appium configuration file to see if the configuration of 1.21 is different from that of 1.17. Finally, the ADB stopped responding, and the kill – server didn’t respond. It’s better to restart. Fortunately, after the restart, appium version 1.21 also successfully started the session, and no error was reported. 😂😂

Summary

If the results of appium doctor are all installed, there are also versions of Android SDK, JDK version is also 1.8, and so on. Direct suggestion

adb kill-server
adb start-server
adb shell

Maybe it can be solved. If there is no solution, you are welcome to throw out the mistakes and discuss them together. Even if I agree, it is not allowed to reprint

Appium step pit summary — solution

1. There are appium command version and appium desktop version in the computer, After opening appium desktop version, the script will run with an error:
selenium.common.exceptions.webdriverexception: Message: an unknown server-side error occurred while processing the command. Original error: cannot start the ‘com. XXXX’ application.
main meaning: an unknown server-side error occurred while processing the command

Check:
I found that the command line version (1.20.2) is inconsistent with the desktop version (1.14.1), appium – V, view version

Solution:
close the desktop version, enter appium in the CMD to execute the command line version, execute the script, and it can run successfully
solution 2: upgrade the desktop appium version or reduce the appium command line version

[solution] original error: Chrome not realizable

background

Use appium to do something.

Error report after running:

An unknown server-side error occurred while processing the command. Original error: chrome not reachable

problem analysis

My control script should be no problem, running well on my own computer, so it must be a problem of environment.

From the following aspects:

1、Chrome Driver
2、ADB
3、Appium Desired Capabilities

First, analyze chrome driver to see if it matches the target chrome version on your phone.

Let’s see if the ADB version is the latest or matches your mobile system version.

The problem I have here is that the version of ADB is too low to work properly.

Next, let’s see if several key attributes in desired capabilities match the mobile phone you want to operate. Focus on the following:

platformNameplatformVersionautomationName

resolvent

After the above analysis, the solution is natural.

For my problems, update ADB.

Run again to solve the problem.

Here is just to provide you with an idea, you can choose flexibly according to your own situation.

Attached: reference materials

Appium official document: http://appium.io/docs/en/writing-running-appium/caps/Github Issue: https://github.com/appium/appium/issues/10129

Error reporting UI hierarchy using uiautomatorviewer

For learning appium framework for the first time, when using uiautomatorviewer to locate Android App controls, you will occasionally see the following exception, which is usually Baidu. Most of them did not find the answer, so they gave up using this tool, chose other tools or gave up appium automation directly.  

Some bigwigs will say that it’s too expensive for the novice research framework to let the developer change the internal (code) of the development package. In fact, in most cases, the mobile phone is not compatible. It’s better to change the mobile phone, but sometimes the mobile phone that can be used suddenly can’t be used. Here, there is a universal use to reduce the cost of novice learning

1: Build tools first

The method is as follows

Click directly on the CMD command line

 

adb shell uiautomator dump /sdcard/ app.uix

adb pull /sdcard/ app.uix E:/ app.uix

#Storage to disk e app.uix Folder, create one in disk E in advance app.uix Formatted folder

adb shell screencap -p /sdcard/ app.png

adb pull /sdcard/ app.png E:/ app.png

#Storage to disk e app.png Folder, create one in disk E in advance app.png Formatted folder

 

Because every time you have to write four lines of code, it’s troublesome, so you write a batch file.

Put it on the desktop and run it directly: (if you don’t know how to do bat, go to Baidu by yourself)

 

2: Using tools

1: First, connect the mobile phone to the ADB, open the page to be located, double-click the written tool, and then the mobile phone interface map will be intercepted successfully

2: Open uiautomatorviewer.bat The operation is shown in the figure below

At this point, open the picture, you can locate the various elements of the page

Of course, some people still think that this kind of trouble, of course, there are other tools can also get page elements.

 

Could not sync socket: %1

C:\Users\Administrator>adb devices -l
List of devices attached
adb server version (31) doesn’t match this client (40); Killing…
could not read OK from ADB server
* failed to start daemon
error: cannot connect to daemon
— prompt the above information. The solution is as follows: —
C: (users, administrator & gt; CD \

C: \ & gt; D:

D: \ & gt; CD: androidsdk, platform tools

D: (androidsdk, platform tools & gt; netstat -aon|findstr “5037”
  TCP    127.0.0.1:5037         0.0.0.0:0              LISTENING       10676

D:\androidsdk\platform-tools>tasklist|findstr “10676”
LdsMobileLink.exe             10676 Console                    1     27,344 K

——–Manually end the above process, from the new ADB devices – L ——– – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – -;  starting now at  tcp:5037
* daemon started successfully
2PFNW18B08014453       device  product:JKM-AL00b   model:JKM_ AL00b  device:HWJKM-HM  transport_ id:1

Appium connecting to the ADB 5037 port of nocturnal simulator is occupied by itself

The reason for the error of

is that the adb. Exe in the
SDK platform is inconsistent with the adb version in the night god simulator, so just replace it.
replace adb. Exe in SDK with adb. Exe in nox, the nocturne simulator, and reconnect.
copies adb.exe from the night god simulator into appium and replaces
to connect again in the command window: enter adb connect 127.0.0.1:62001