【问题标题】:Detox. Click on IOS native system pop-up doesn't work排毒。点击IOS本机系统弹出不起作用
【发布时间】:2020-03-04 00:42:59
【问题描述】:

这是我通过 google sso 登录应用程序后弹出的确认提示。

Native pop-up screenshot

我遇到了在此弹出窗口中单击“继续”按钮的问题。我已经看到一些关于此类问题的讨论,但没有任何帮助。 这是我尝试过的 - Detox: iOS Simulator how to confirm alert message,但它没有用。 另外,我在 appium app 中打开了一个应用程序以查看那里的确切元素名称,尝试在测试中使用它,但没有成功。

Appium screenshot

这就是我与元素交互的方式

it('should have welcome screen', async () => {
    await expect(element(by.id('hostname-input'))).toBeVisible();
    await element(by.id('hostname-input')).typeText('companyName');
    await element(by.id('hostname-submit-button')).tap();
    await element(by.id('googleAuthButton')).tap();
    //  XCUIElementTypeButton[@name="Continue"]
    await waitFor(element(by.type('XCUIElementTypeButton')))
      .toExist()
      .withTimeout(10000);
    await element(
      by.name('Continue').and(by.type('XCUIElementTypeButton')),
    ).tap();
  });

这是错误:

Element matcher: ((!(kindOfClass('RCTScrollView')) && ((kindOfClass('(null)') && isNotNil) && !(kindOfClass('UIAccessibilityTextFieldElement')))) || (((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(kindOfClass('RCTScrollView'))) && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(((kindOfClass('(null)') && isNotNil) && !(kindOfClass('UIAccessibilityTextFieldElement')))))))

关于如何解决这个问题的任何想法? 提前致谢。

【问题讨论】:

    标签: detox


    【解决方案1】:

    我写了一个辅助函数:

    
    const alertsHelper = async (name) => {
        await element(by.label(name).and(by.type('_UIAlertControllerActionView'))).tap();
      };
    
    export default alertsHelper;
    

    这样使用:

    await alertsHelper('Continue');

    【讨论】:

      猜你喜欢
      • 2018-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-07
      • 2021-12-28
      • 1970-01-01
      • 1970-01-01
      • 2018-12-17
      相关资源
      最近更新 更多