MC-SM9:
私はAppiumを使ってAndroidアプリで任意のページの一番下までスクロールすることができません。複数のアプローチは、スタックオーバーフローの上に見られるものを含め、試みられました。(この課題は、一般的なようです。)しかし、すべての試みが失敗しました。
環境:
- Appiumバージョン1.6.2
- Appiumクライアント:ジャワ(Javaのクライアント-6.1.0.jar)
- Androidのバージョン:5.1、6.0.1、7.1.1
- Javaのバージョン:jre1.8.0_171
- セレンバージョン:セレンのjava-3.13.0
- アプリの種類:コルドバ(ハイブリッド)。アプリはコルドバで構築されていますが、実行している場合
System.out.println(driver.getContext());
、結果はNATIVE_APP
この問題を解決することができます任意の代替または改良を共有してください。任意の有用な提案は大歓迎です!
以下は、試行された様々なアプローチを要約したものです。
- アプローチ:のscrollIntoView()(様々な実装形態)
- 出典:Udemyコース
- エラー:しないのスクロールとNOエラー
- アプローチ:トライキャッチ>のscrollIntoView()
- 出典:https://stackoverflow.com/questions/39658626/how-to-scroll-top-to-botton-using-android-driver
- エラー:一部動作します:ダウンが、十分ではないページをスクロール
- アプローチ:スワイプ
- 出典:https://stackoverflow.com/questions/39130591/swipe-or-scroll-to-bottom-in-appium-android
- エラー:スワイプが廃止されました
- アプローチ:touchAction.longPress +のmoveTo
- 出典:https://stackoverflow.com/questions/44282417/how-to-scroll-with-appium-1-7-1-using-touchaction
- エラー:「ドライバーは解決できません」
- アプローチ:touchAction.longPress +のmoveTo
- 出典:https://stackoverflow.com/questions/44282417/how-to-scroll-with-appium-1-7-1-using-touchaction
- エラー:「メソッドlongPress(LongPressOptions)型TouchActionでは、引数(int型、int型)には適用されません」
- アプローチ:touch.longPress +のmoveTo
- 出典:https://stackoverflow.com/questions/50304699/how-to-scroll-to-specific-element-inlatest-version-of-appium-using-java
- エラー:「お持ち帰りは解決できません」
- アプローチ:のmoveTo +座標を使用して
- 出典:http://www.automationtestinghub.com/appium-scroll-examples/
- エラー:「プレス」アクションが推奨されていません!
- アプローチ:スワイプ+のmoveToに押しアプローチを使用して
- 出典:https://stackoverflow.com/questions/49004686/scroll-text-area-with-terms-and-conditions-on-hybrid-app-with-appium
- エラー:「メソッドプレス(AndroidElement)はObject型のために定義されていません」
- アプローチ:touchAction「タップ」を使用して座標
- 出典:https://discuss.appium.io/t/scrolling-to-element-in-android-app-using-java/17208
- エラー:なし。それは部分的に動作します:ダウンページをスクロールしなく十分!
- アプローチ:UiScrollableは>親スクロール可能なフレームと子要素を指定します
- 出典:https://stackoverflow.com/a/51003840/9214050
- エラー:「:このメソッドを呼び出すためにリフレクションを使用して問題UiSelector引数を解析できませんでした」
- アプローチ:UiScrollableは>親スクロール可能なフレームと「のscrollIntoView」子要素を指定します
- 出典:https://stackoverflow.com/a/51003840/9214050
- エラー:しないのスクロールとNOエラー
- アプローチ:CSSスタイルを使用して「真」に「偽」からのページ要素のための「スクロール可能な」属性を変更
- 出典:http://burnignorance.com/html-tips/making-a-smooth-scroll-view-for-android-ios-in-html/
- エラー:なし、しかし、アプリはページの一番下までスクロールしません。
- アプローチ:タッチアクション:「モバイル:スワイプ」、「モバイル:スクロール」(http://appium.io/docs/en/writing-running-appium/touch-actions/)
- 出典:https://stackoverflow.com/questions/32387357/i-cant-make-swipe-gesture-work-for-me-in-appium-using-java#
- エラー:「不明なモバイルコマンド 『スクロール』のみシェル、startLogsBroadcastは、stopLogsBroadcastコマンドがサポートされています。」
- アプローチ:HashMapの+ scrollObject.put
- 出典:http://appium.io/docs/en/writing-running-appium/touch-actions/
- エラー:「不明なモバイルコマンド 『スクロール』のみシェル、startLogsBroadcastは、stopLogsBroadcastコマンドがサポートされています。」
- アプローチ:(それはコルドバアプリだから)「のWebView」と「ネイティブ」からアプリの内容を調整
- 出典:https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md
- エラー:メインの「スレッドの例外 『』 org.openqa.selenium.WebDriverException:取るのHttpClient、InputStreamをして長い 『のCreateSessionが』が見つかりませんでしたか、それはアクセスできないため、新しいセッションを作成することは不可能です。」
- エラー:「org.openqa.selenium.WebDriverException:不明なサーバー側のエラーがコマンドの処理中に元のエラーが発生しました:いいえChromedriverはそれがクローム'58 .0.3029' を自動化することができたhttps://github.com/appium/を参照してください。 appium /ブロブ/マスター/ドキュメント/ EN /書き込み-ランニング-appium /ウェブ/詳細chromedriver.md(警告:サーバは任意のスタックトレース情報を提供しませんでした)。」
driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(resourceId(\"send-to-email-app\"));").click();
try { driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"Send\"))"); }catch(Exception e) { System.out.println("We got an error scrolling!"); }
driver.swipe(0, Startpoint,0,scrollEnd,1000);
...touchAction.longPress(fromX, fromY).moveTo(toX, toY).release().perform();
TouchAction touchAction = new TouchAction(driver); touchAction.longPress(10, 10).moveTo(x, y).release().perform();
...TouchAction touch = new TouchAction(driver); touch.longPress(co_ordinates[0], co_ordinates[1]).moveTo(dinates[0], dinates[1]).release().perform();
actions.press(startX, startY).waitAction(Duration.ofSeconds(2)).moveTo(endX, endY).release().perform();
TouchAction().press(el0).moveTo(el1).release();
TouchAction touchAction = new TouchAction(driver); touchAction.tap(PointOption.point(x, y)).perform();
MobileElement doeButton = driver.findElement(MobileBy.AndroidUIAutomator( "new UiScrollable(new UiSelector().text(\"Android scrollbar test\")).getChildByText(" + "new UiSelector().className(\"android.widget.TextView\"), \"Doe\")"));
MobileElement sendEmailButton = driver.findElement(MobileBy.AndroidUIAutomator( "new UiScrollable(new UiSelector().resourceId(\"content\")).scrollIntoView(" + "new UiSelector().resourceId(\"add-task-button\"))")); sendEmailButton.click();
JavascriptExecutor js = (JavascriptExecutor) driver; HashMap params = new HashMap(); params.put("direction", "up"); js.executeScript("mobile: swipe", params);
JavascriptExecutor js = (JavascriptExecutor) driver; HashMap scrollObject = new HashMap(); scrollObject.put("direction", "down"); js.executeScript("mobile: scroll", scrollObject);
appCapabilities.setCapability("autoWebview", "true");
トースト:
上記提案のオプションのバリエーションとして、ここでは実装のもう一つの方法であるTouchAction
との組み合わせでpress
そしてmoveTo
私のために働いた方法。これは、下方画面スワイプもたらします。あなたは、単にあなたのクライアントに最高の作品何に座標を調整する必要がある場合があります。
new TouchAction(driver).press(PointOption.point(550, 640)).waitAction().moveTo(PointOption.point(550, 60)).release().perform();
追加情報については、あなたは、これらの参照をチェックアウトすることがあります。