如何使用Ruby

时间:2017-05-15 17:37:38

标签: ios ruby automation cucumber

我一直在使用Ruby和Cucumber Framework自动化应用程序。我在这个框架中使用XCUITest进行iOS自动化。

从我做过的研究看来,似乎我必须将文本发送到拣选轮才能调整到所需的值。这是我尝试使用的代码:

Then(/^I click on month"([^"]*)"$/) do |month_number|
  find_element(xpath: "//XCUIElementTypePickerWheel[1]").adjustToPickerWheelValue("#{month_number}")
end

使用此代码,我的Cucumber框架调用该元素的find_element方法并尝试发送" month_number"值为" adjustToPickerWheelValue"方法。

我尝试使用此方法时收到的错误是标准的noMethod错误:

undefined method `adjustToPickerWheelValue' for #<Selenium::WebDriver::Element:0x007f802cda98d8> (NoMethodError)

在我的env.rb文件中调用此方法需要做些什么特别的事情吗?现在我只有&#34; appium_lib&#34;按要求。是否还有一个我需要使用的XCUITest库?

非常感谢任何和所有帮助。我是自动化iOS的新手。感谢您的阅读,我希望很快能收到您的回复。

1 个答案:

答案 0 :(得分:0)

xcuitest的方法是

select_picker_wheel(element:, order:, offset: nil)