首页 > 解决方案 > 如何使用 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>

谢谢,房车

标签: rubyseleniumappiumpageobjectsappium-android

解决方案


推荐阅读