#appium
#appium
Вопрос:
Я новичок в Appium. Я запускаю свое приложение за последние 3 недели, используя этот код. внезапно, когда я запускаю это из другого класса, он показывает эту ошибку на сервере appium. Я знаю, почему это происходит. Я запускаю его утром.
базовый класс открытого класса {
public AndroidDriver<AndroidElement> driver;
@BeforeClass
public AndroidDriver<AndroidElement> capabilities() throws MalformedURLException{
File appDir = new File("src/test/resources");
File app = new File(appDir, "KandareeLiteApp.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, "100");
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME, MobilePlatform.ANDROID);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "emulator-5554");
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
capabilities.setCapability("appPackage", "bd.com.cslsoft.kandareeliteapp");
capabilities.setCapability("appActivity","bd.com.cslsoft.kandareeliteapp.view.activities.LauncherActivity");
driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
driver.resetApp();
}
Вот код на стороне сервера Appium — при запуске [Logcat] это занимает так много времени.
[W3C] Calling AppiumDriver.createSession() with args: [{"app":"D:\Automation Project\Resources\KandareeLiteApp\src\test\resources\KandareeLiteApp.apk","appActivity":"bd.com.cslsoft.kandareeliteapp.view.activities.LauncherActivity","appPackage":"bd.com.cslsoft.kandareeliteapp","newCommandTimeout":"100","platformName":"Android","deviceName":"emulator-5554"},null,{"firstMatch":[{"appium:app":"D:\Automation Project\Resources\KandareeLiteApp\src\test\resources\KandareeLiteApp.apk","appium:appActivity":"bd.com.cslsoft.kandareeliteapp.view.activities.LauncherActivity","appium:appPackage":"bd.com.cslsoft.kandareeliteapp","appium:deviceName":"emulator-5554","appium:newCommandTimeout":"100","platformName":"android"}]}]
[BaseDriver] Event 'newSessionRequested' logged at 1606228007305 (20:26:47 GMT 0600 (Bangladesh Standard Time))
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[Appium]
[Appium] ======================================================================
[Appium] DEPRECATION WARNING:
[Appium]
[Appium] The 'automationName' capability was not provided in the desired
[Appium] capabilities for this Android session
[Appium]
[Appium] Setting 'automationName=UiAutomator2' by default and using the
[Appium] UiAutomator2 Driver
[Appium]
[Appium] The next major version of Appium (2.x) will **require** the
[Appium] 'automationName' capability to be set for all sessions on all
[Appium] platforms
[Appium]
[Appium] In previous versions (Appium <= 1.13.x), the default was
[Appium] 'automationName=UiAutomator1'
[Appium]
[Appium] If you wish to use that automation instead of UiAutomator2, please
[Appium] add 'automationName=UiAutomator1' to your desired capabilities
[Appium]
[Appium] For more information about drivers, please visit
[Appium] http://appium.io/docs/en/about-appium/intro/ and explore the
[Appium] 'Drivers' menu
[Appium]
[Appium] ======================================================================
[Appium]
[Appium] Appium v1.18.3 creating new AndroidUiautomator2Driver (v1.56.1) session
[Appium] Applying relaxed security to 'AndroidUiautomator2Driver' as per server command line argument. All insecure features will be enabled unless explicitly disabled by --deny-insecure
[BaseDriver] W3C capabilities and MJSONWP desired capabilities were provided
[BaseDriver] Creating session with W3C capabilities: {
[BaseDriver] "alwaysMatch": {
[BaseDriver] "platformName": "android",
[BaseDriver] "appium:app": "D:\Automation Project\Resources\KandareeLiteApp\src\test\resources\KandareeLiteApp.apk",
[BaseDriver] "appium:appActivity": "bd.com.cslsoft.kandareeliteapp.view.activities.LauncherActivity",
[BaseDriver] "appium:appPackage": "bd.com.cslsoft.kandareeliteapp",
[BaseDriver] "appium:deviceName": "emulator-5554",
[BaseDriver] "appium:newCommandTimeout": "100"
[BaseDriver] },
[BaseDriver] "firstMatch": [
[BaseDriver] {}
[BaseDriver] ]
[BaseDriver] }
[BaseDriver] Number capability passed in as string. Functionality may be compromised.
[BaseDriver] Capability 'newCommandTimeout' changed from string ('100') to integer (100). This may cause unexpected behavior
[BaseDriver] Session created with session id: 9ff2777d-7fcd-4a7e-8e9d-02b3eed680f0
[BaseDriver] Using local app 'D:Automation ProjectResourcesKandareeLiteAppsrctestresourcesKandareeLiteApp.apk'
[UiAutomator2] Checking whether app is actually present
[ADB] Using 'adb.exe' from 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe'
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 start-server'
[AndroidDriver] Retrieving device list
[ADB] Trying to find a connected android device
[ADB] Getting connected devices
[ADB] Connected devices: [{"udid":"emulator-5554","state":"device"}]
[AndroidDriver] Using device: emulator-5554
[ADB] Using 'adb.exe' from 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe'
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 start-server'
[ADB] Setting device id to emulator-5554
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk'
[ADB] Current device property 'ro.build.version.sdk': 29
[ADB] Getting device platform version
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[ADB] Current device property 'ro.build.version.release': 10
[ADB] Device API level: 29
[UiAutomator2] Relaxing hidden api policy
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 shell 'settings put global hidden_api_policy_pre_p_apps 1;settings put global hidden_api_policy_p_apps 1;settings put global hidden_api_policy 1''
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 wait-for-device'
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 shell echo ping'
[AndroidDriver] Pushing settings apk to device...
[ADB] Getting install status for io.appium.settings
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[ADB] 'io.appium.settings' is installed
[ADB] Getting package info for 'io.appium.settings'
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 shell dumpsys package io.appium.settings'
[ADB] The version name of the installed 'io.appium.settings' is greater or equal to the application version name ('3.2.0' >= '3.2.0')
[ADB] There is no need to install/upgrade 'D:New folderAppium-windows-1.18.3resourcesappnode_modulesappiumnode_modulesio.appium.settingsapkssettings_apk-debug.apk'
[ADB] Getting IDs of all 'io.appium.settings' processes
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?''
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 shell pgrep -f io\.appium\.settings'
[AndroidDriver] io.appium.settings is already running. There is no need to reset its permissions.
[Logcat] Starting logs capture with command: C:\Users\syedyunus\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 logcat -v threadtime
[UiAutomator2] Deleting UiAutomator2 session
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 shell am force-stop bd.com.cslsoft.kandareeliteapp'
[Logcat] Stopping logcat capture
[UiAutomator2] Restoring hidden api policy to the device default configuration
[ADB] Running 'C:UserssyedyunusAppDataLocalAndroidSdkplatform-toolsadb.exe -P 5037 -s emulator-5554 shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy''
[BaseDriver] Event 'newSessionStarted' logged at 1606228129127 (20:28:49 GMT 0600 (Bangladesh Standard Time))
[W3C] Encountered internal error running command: Error: Could not acquire lock on C:UsersSYEDYU~1AppDataLocalTempuia2_device_port_guard. Original error: Error: EEXIST: file already exists, open 'C:UsersSYEDYU~1AppDataLocalTempuia2_device_port_guard'
[W3C] at guard (D:New folderAppium-windows- 1.18.3resourcesappnode_modulesappiumnode_modulesappium-supportlibutil.js:477:13)
[W3C] Destroying socket connection
[HTTP] <-- POST /wd/hub/session 500 121825 ms - 1023
Комментарии:
1. Вы решаете эту проблему??? как вы решаете эту проблему??? я сталкиваюсь с теми же проблемами.
Ответ №1:
Вы можете вручную удалить файл uia2_device_port_guard из указанного местоположения, а затем запустить. Это сработало и для меня.
Ответ №2:
Перейдите к: C:Users(username)AppDataLocalTemp
Найти: uia2_device_port_guard
файл
Удалите его
Перезапустите сервер Appium
Ответ №3:
Пожалуйста, удалите uia2_device_port_guard
файл, он будет работать нормально. Если вы не знаете путь, выполните следующие действия,
- Открыть окно запуска (Ctrl R)
- Введите
temp
и нажмите OK - Выберите все и удалите все временные файлы.
- Снова напишите
%temp%
в открытом поле и нажмите OK - Выберите все и очистите все временные файлы
uia2_device_port_guard
файл будет удален автоматически- После удаления обоих временных файлов обновите и снова откройте. Он будет работать нормально.
Поскольку я сделал то же самое, и он начал работать нормально.
Комментарии:
1. А для компьютера Mac?
Ответ №4:
Для пользователей Mac:
- Открыть терминал
- Перейдите к
/var/folders/92/hbvgxyp96p3f5vxzgsf1thh80000gp/T
- Удалить файл
uia2_device_port_guard
Команда:
rm uia2_device_port_guard