[問題] python + Appium問題
https://imgur.com/a/cELeNf3
想要點擊APP工具列的按鈕
但是按鈕元素不是沒有ID,就是ID重複 (ClassName也重覆)
Name在新版APPIUM已無法使用 (雖然很多也沒text)
目前嘗試了三個寫法,但是都沒法定位到元素
想請教各位大大,是哪裡有問題
----------------------------------------------
1.Xpath 方式
driver.find_element_by_xpath('//android.widget.LinearLayout/android.support.v7.app.ActionBar.Tab[1]/android.widget.LinearLayout/android.widget.ImageView').click()
按照層級去寫入元素,但是運行超過十分鐘還定位不到元素,後來APPIUM server就斷線
了
urllib3.exceptions.ProtocolError: ('Connection aborted.',
RemoteDisconnected('Remote end closed connection without response'))
2.text轉成 Xpath 方式
driver.find_element_by_xpath("//*[@text='订单']").click()
想定位按鈕下方的文字,但是跟上面一樣,運行很久後就斷線
3.uiautomator 方式
driver.find_element_by_android_uiautomator('new
UiSelector().className("\android.support.v7.app.ActionBar.Tab\").clickable(true)').click()
運行後出現錯誤訊息,An element could not be located on the page using the
given search parameters
看起來是在介面中找不到指定的元素
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 59.125.4.230 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1572328047.A.4F9.html
推
10/31 20:16,
5年前
, 1F
10/31 20:16, 1F
→
10/31 20:17,
5年前
, 2F
10/31 20:17, 2F
→
10/31 20:18,
5年前
, 3F
10/31 20:18, 3F
Python 近期熱門文章
PTT數位生活區 即時熱門文章