Appium测试在我们的应用程序的先前版本中有效,但并非在我们的应用程序的新版本中均有效

时间:2018-11-01 15:24:25

标签: java android automated-tests appium

当我们在2.4.0版本中运行Appium测试时,他们的合格率为100%。但是,在我们的新版本2.5.0中,某些测试失败了。

它们失败了,因为在某些屏幕上它们找不到元素。元素的ID在2.5.0中与在2.4.0中完全相同。

我确保它正在等待屏幕加载。发生的情况是它将经过几个屏幕,然后始终卡在同一屏幕上,并在该屏幕上停留我设置的超时时间,然后失败说无法找到该元素。

以下是测试进入输入名称屏幕时的鸦片记录。它应该找到名字字段,然后发送文本。

How much volume was processed by each node.
How much of the total time was consumed 
a)by the actual flush + compaction at each node 
b)time taken by the cluster to resolve the node/partition(hashing)
c)network latency in chaperoning the data to the node

以下是用于将密钥发送到名字字段的方法:

> [debug] [MJSONWP] Calling AppiumDriver.findElement() with args:
> ["id","Step3.firstname","489801e6-96d8-45f8-9712-0c2ec940413b"]
> [debug] [BaseDriver] Valid locator strategies for this request: xpath,
> id, class name, accessibility id, -android uiautomator [debug]
> [BaseDriver] Waiting up to 0 ms for condition [debug]
> [AndroidBootstrap] Sending command to android:
> {"cmd":"action","action":"find","params":{"strategy":"id","selector":"Step3.firstname","context":"","multiple":false}}
> [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got data from
> client:
> {"cmd":"action","action":"find","params":{"strategy":"id","selector":"Step3.firstname","context":"","multiple":false}}
> [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command of type
> ACTION [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Got command
> action: find [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug]
> Finding 'Step3.firstname' using 'ID' with the contextId: '' multiple:
> false [debug] [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
> UiSelector[INSTANCE=0,
> RESOURCE_ID=com.readytouchpos.smallstore:id/Step3.firstname] [debug]
> [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
> UiSelector[INSTANCE=0, RESOURCE_ID=android:id/Step3.firstname] [debug]
> [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
> UiSelector[INSTANCE=0, RESOURCE_ID=Step3.firstname] [debug]
> [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
> UiSelector[DESCRIPTION=Step3.firstname, INSTANCE=0] [debug]
> [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Failed to locate element.
> Clearing Accessibility cache and retrying. [debug] [AndroidBootstrap]
> [BOOTSTRAP LOG] [debug] Finding 'Step3.firstname' using 'ID' with the
> contextId: '' multiple: false [debug] [AndroidBootstrap] [BOOTSTRAP
> LOG] [debug] Using: UiSelector[INSTANCE=0,
> RESOURCE_ID=com.readytouchpos.smallstore:id/Step3.firstname] [debug]
> [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
> UiSelector[INSTANCE=0, RESOURCE_ID=android:id/Step3.firstname] [debug]
> [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
> UiSelector[INSTANCE=0, RESOURCE_ID=Step3.firstname] [debug]
> [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Using:
> UiSelector[DESCRIPTION=Step3.firstname, INSTANCE=0] [debug]
> [AndroidBootstrap] [BOOTSTRAP LOG] [debug] Returning result:
> {"status":7,"value":"No element found"} [debug] [AndroidBootstrap]
> Received command result from bootstrap [debug] [MJSONWP] Matched
> JSONWP error code 7 to NoSuchElementError [debug] [MJSONWP]
> Encountered internal error running command: NoSuchElementError: An
> element could not be located on the page using the given search
> parameters. [debug] [MJSONWP]     at AndroidDriver.callee$0$0$
> (C:\Users\arroy\AppData\Roaming\npm\node_modules\appium\node_modules\appium-android-driver\lib\commands\find.js:75:11)
> [debug] [MJSONWP]     at tryCatch
> (C:\Users\arroy\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
> [debug] [MJSONWP]     at GeneratorFunctionPrototype.invoke [as
> _invoke] (C:\Users\arroy\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
> [debug] [MJSONWP]     at
> GeneratorFunctionPrototype.prototype.(anonymous function) [as throw]
> (C:\Users\arroy\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
> [debug] [MJSONWP]     at GeneratorFunctionPrototype.invoke
> (C:\Users\arroy\AppData\Roaming\npm\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
> [debug] [MJSONWP]     at <anonymous>

这是typeFirstName方法中使用的wait方法:

> public EnterNameScreen typeFirstName(String firstName){
>         waitForElement(firstNameTextBox).sendKeys(firstName);
>         return this;
>     }

请记住,这些在我们的2.4.0版本中可以正常工作。只有在我们的新版本2.5.0中,它才停止工作。某些按钮仍按预期方式被单击,某些字段仍按预期方式获取发送的文本,但上面的示例没有这样。 有人发生过吗?可能是在应用程序上更新后导致此问题的库吗?

0 个答案:

没有答案