V
V
vladislav_x2020-07-14 19:12:57
Python
vladislav_x, 2020-07-14 19:12:57

Appium Selenium key press not working?

I decided to learn automation using Python, Appium, Selenium web.driver and Android Studio to emulate an android device.
The application is loaded on the device, but there is no keystroke ... I have already tried a lot of things, but I can not solve the problem.
I am using UI Automator to get the resource_id and use it.
The code itself:

from appium import webdriver
from selenium.webdriver.common.by import By

desired_capabilities = {
    "platformName": "Android",
    "platformVersion": "9",
    "deviceName": "Android Emulator",
    "app": "C:/Users/Vladislav/PycharmProjects/Appium test/app_binaries/Wikipedia_v2.7.50324-r-2020-06-29_apkpure.com.apk",
}

driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_capabilities=desired_capabilities)

driver.implicitly_wait(1)
driver.find_element_by_id("org.wikipedia:id/fragment_onboarding_skip_button").click()

Mistake:
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Cannot start the 'org.wikipedia' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: 'org.wikipedia.main.MainActivity' or 'org.wikipedia.org.wikipedia.main.MainActivity' never started. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting


Appium console:
Event 'newSessionStarted' logged at 1594738341179 (17:52:21 GMT+0300 (Москва, стандартное время))
[W3C] Encountered internal error running command: Error: Cannot start the 'org.wikipedia' application. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting. Original error: 'org.wikipedia.main.MainActivity' or 'org.wikipedia.org.wikipedia.main.MainActivity' never started. Visit https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/android/activity-startup.md for troubleshooting
[W3C]     at ADB.startApp (C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:165:11)
[W3C] Destroying socket connection
[HTTP] <-- POST /wd/hub/session 500 27672 ms - 1409
[HTTP] 
[Instrumentation] .
[Instrumentation] Time: 24.062
[Instrumentation] 
[Instrumentation] OK (1 test)
[Instrumentation] The process has exited with code 0

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vladislav_x, 2020-07-25
@vladislav_x

Problem solved, added "appPackage" and "appActivity"

A
Alexey, 2020-07-23
@poweruser

The text of the error (Cannot start the 'org.wikipedia' application) suggests that an invalid application ID was specified. You could try writing the button ID in shorthand form (fragment_onboarding_skip_button) since you are declaring that the application is being launched.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question