在appium中使用给定的搜索参数无法在页面上找到元素

时间:2020-06-22 06:49:50

标签: automation jestjs appium enzyme

嘿,我在appium中遇到问题,当我尝试运行测试文件时,出现了这样的错误

[elementByAccessibilityId(“ ChangeFullNameButton”)]错误响应 状态:7,NoSuchElement-无法在 使用给定搜索参数的页面。硒错误:元素 使用给定的搜索参数无法在页面上定位。

问题是:导航后无法获取元素,但在屏幕运行之前无法获取

这是我的测试代码:

import wd from 'wd'

jasmine.DEFAULT_TIMEOUT_INTERVAL = 60000
const PORT = 4723

const config = {
  platformName: 'Android',
  deviceName: 'Pixel XL API 29',
  app:
    'lacation app',
}

const driver = wd.promiseChainRemote('localhost', PORT)

beforeAll(async () => {
  await driver.init(config)
  await driver.sleep(10000)
})

describe('Change Full Name Flow', () => {
  test('Render Profile Screen', async () => {
    const element = await driver.elementByAccessibilityId('pointBalanceButton')
    await element.click()
  })

  test('Click button Ubah', async () => {
    await driver.sleep(4000)
    const element = await driver.elementByAccessibilityId(
      'ChangeFullNameButton',
    )
    await element.click()
  })
})

谢谢

0 个答案:

没有答案