【问题标题】:Detox - cannot use the scroll action on a ScrollView element排毒 - 不能在 ScrollView 元素上使用滚动操作
【发布时间】:2020-11-04 22:00:21
【问题描述】:

很遗憾,我不明白为什么 scrollscrollTo 操作不起作用。

这很奇怪,因为swipe 操作对相同的元素工作正常。

当然,ScrollView 元素存在并且可见

排毒版: 16.9.2

行动:

await element(by.id('some')).scrollTo('bottom');

元素:

<ScrollView testID="some">

错误信息:

Cannot find UI element.
    Exception with Action: {
      "Action Name":  "Scroll To Bottom content edge",
...

Error Trace: [
      {
        "Description":  "Interaction cannot continue because the desired element was not found.",
        "Error Domain":  "com.google.earlgrey.ElementInteractionErrorDomain",
        "Error Code":  "0",
        "File Name":  "GREYElementInteraction.m",
        "Function Name":  "-[GREYElementInteraction matchedElementsWithTimeout:error:]",
        "Line":  "124"
      }
    ]

【问题讨论】:

    标签: react-native e2e-testing detox


    【解决方案1】:

    试试这个看看它是否适合你:

    await waitFor(element.by(id('element_you_looking_for_at_the_bottom')))
       .toBeVisible()
       .whileElement(by.id('some')) // where some is your ScrollView testID
       .scroll(50, 'down')
    

    我遇到了和你一样的问题,所以不得不改用这种方法

    【讨论】:

    • 什么是awaitFor?你有一个语法错误。正确的语法是:await waitFor(element(by.id('elementTestId'))).toBeVisible().whileElement(by.id('scrollViewTestId')).scroll(100, 'down')
    猜你喜欢
    • 2019-07-19
    • 1970-01-01
    • 2018-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多