ruby - 如何使用 appium ruby 初始化隐藏页面对象
问题描述
我正在为移动应用程序使用页面对象模型。我无法初始化隐藏在页面上但稍后在测试中可见的元素。有人可以建议它的解决方案是什么吗?以下是代码和错误:
class AppDetails
include PageObject
attr_reader :appium_driver, :screen, :button, :header, :more_info, :type
def initialize(driver, package_name)
@screen = driver.find_element(blaahh)
@button = driver.find_element(blaahh)
@more_info = driver.find_element(blaahh) **###hidden element**
@type = driver.find_element(blaahh) **###hidden element**
end
end
当我运行自动化时,出现以下错误:
Selenium::WebDriver::Error::NoSuchElementError: An element could not be located on the page using the given search parameters.
NoSuchElementError: An element could not be located on the page using the given search parameters.
at AndroidDriver.callee$0$0$ (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-android-driver/lib/commands/find.js:69:13)
at tryCatch (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:67:40)
at GeneratorFunctionPrototype.invoke [as _invoke] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:315:22)
at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:100:21)
at GeneratorFunctionPrototype.invoke (/Applications/Appium.app/Contents/Resources/app/node_modules/appium-android-driver/node_modules/babel-runtime/regenerator/runtime.js:136:37)
at <anonymous>
谢谢,房车
解决方案
推荐阅读
- javascript - 在多个元素的数据属性上添加更改侦听器
- wso2 - 我想访问 WSO2 管理员时遇到问题
- django - 如何编辑 Django 管理员用户社交身份验证列表页面?
- keras - 如果然后在自定义不可训练的 keras 层内
- java - 如何将 java sdk 连接到 qldb?
- dbpedia - 2019 DBpedia 是否有“另见”数据集?
- python - 为什么我不能 pip 安装任何超过 2.7 的 python 模块,有没有解决方案?
- c# - 从另一个窗口复制文本的代码
- mysql - 希伯来语的Mysql排序规则
- openssl - 在 DDEV-Local v1.13+ 中,我收到针对外部站点的 API 失败(SSL/TLS 错误)