前提
Android実機端末をMacに接続し、appiumで操作するプログラムをpythonで作成しております。
その際まずアプリAを立ち上げ、次にアプリBのテキストをコピーし、再度アプリAをアクティブにして入力欄にペーストする際に下記のエラーが出ます。具体的にはアプリBは2段階認証アプリで、認証パスをコピーしてアプリAにペーストしログインする、ということを実現したいです。ご教示いただけましたらありがたいです。よろしくお願いいたします。
実現したいこと
1.アプリAを立ち上げ
2.アプリAにテキスト入力(テキストを保持したままバックグラウンドへ)
3.アプリBを立ち上げ
4.アプリBのテキストをコピー
5,アプリBをシャットダウン
6.アプリAをアクティブに
7.アプリAにペースト←ここでエラー
発生している問題・エラーメッセージ
WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: 'POST /element' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed). Check the server log and/or the logcat output for more details Stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: 'POST /element' cannot be proxied to UiAutomator2 server because the instrumentation process is not running (probably crashed). Check the server log and/or the logcat output for more details at UIA2Proxy.command (/Applications/Appium.app/Contents/Resources/app/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:274:13) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:85:5)
該当のソースコード
python
1from appium import webdriver 2from appium.webdriver.common.touch_action import TouchAction 3from appium.webdriver.common.appiumby import AppiumBy 4import pandas as pd 5import re 6 7#stepnを起動 8desired_stepn=dict() 9desired_stepn['platformName']='Android' 10desired_stepn['appPackage']='com.bcy.fsapp' 11desired_stepn['appActivity']='com.bcy.fsapp.activity.MainActivity' 12desired_stepn['noReset'] = True 13driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_stepn) 14 15change_logintype = driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value='Account Login') 16change_logintype.click() 17time.sleep(3) 18id = driver.find_element(AppiumBy.XPATH,'//android.widget.ImageView[@content-desc="ACCOUNT LOGIN"]/android.view.View/android.widget.EditText[1]/android.widget.EditText') 19id.click() 20time.sleep(3) 21id.clear() 22id.send_keys("AAAAA") 23time.sleep(3) 24 25#googleauthenticatorを起動 26desired_google_auth=dict() 27desired_google_auth['platformName']='Android' 28desired_google_auth['appPackage']='com.google.android.apps.authenticator2' 29desired_google_auth['appActivity']='com.google.android.apps.authenticator.AuthenticatorActivity' 30desired_google_auth['noReset'] = True 31g_driver=webdriver.Remote('http://localhost:4723/wd/hub',desired_google_auth) 32 33#最上段を長おし 34TouchAction(g_driver).press(x=493, y=400).perform() 35#画面をタップ 36TouchAction(g_driver).tap(x=493, y=430).perform() 37#g_driverをバックグラウンドへ 38g_driver.background_app(-1) 39 40time.sleep(2) 41#driverをアクティブに 42driver.activate_app("com.bcy.fsapp") 43time.sleep(5) 44 45#ここでエラー 46change_logintype = driver.find_element(by=AppiumBy.ACCESSIBILITY_ID, value='Account Login') 47change_logintype.click()
あなたの回答
tips
プレビュー