亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

無法使用 UIScrollable 和 UISelector 定位元素

無法使用 UIScrollable 和 UISelector 定位元素

小怪獸愛吃肉 2023-04-26 15:02:24
我正在使用此代碼來選擇元素public static void swipe(){    MobileElement element = driver.findElementByAndroidUIAutomator(                    "new UiScrollable(new UiSelector().class(\"android.widget.ImageView\")).getChildByText("                    + "new UiSelector().resourceId(\"com.spotify.music:id/title\"), \"UnderCover\")");    //Perform the action on the element    System.out.println(element.getText()); //This would print - Unblock Me FREE}我把這個當作錯誤io.appium.uiautomator2.common.exceptions.UiSelectorSyntaxException: Could not parse expression `new UiScrollable(new UiSelector().class("android.widget.ImageView")).getChildByText(new UiSelector().resourceId("com.spotify.music:id/title"), "UnderCover")`: UiScrollable has no suitable constructor with arguments [new UiSelector().class("android.widget.ImageView")]at io.appium.uiautomator2.utils.UiExpressionParser.findConstructor(UiExpressionParser.java:232)
查看完整描述

1 回答

?
GCT1015

TA貢獻1827條經驗 獲得超4個贊

公共構造函數UIScrollable是:

UiScrollable(UiSelector?container);

使用類似className的公共方法UiSelector

UiSelector?className?(String?className);?//or?UiSelector?className?(Class<T>?type);

嘗試

new?UiScrollable(new?UiSelector().className("android.widget.ImageView"));

代替

new?UiScrollable(new?UiSelector().class("android.widget.ImageView"));
查看完整回答
反對 回復 2023-04-26
  • 1 回答
  • 0 關注
  • 189 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號