在iOS中,Appium无法使用XPath在WKWebview的文本字段中输入文本( // XCUIElementTypeButton [@name ="提交"] )。
我收到以下错误。
**Then I tap on xPath "//XCUIElementTypeButton[@name="Submit"]" # features/step_definitions/steps.rb:467
Error Domain=com.facebook.WebDriverAgent Code=1 "The element '"Submit" Button' is not visible on the screen and thus is not interactable" UserInfo={NSLocalizedDescription=The element '"Submit" Button' is not visible on the screen and thus is not interactable} (Selenium::WebDriver::Error::UnknownError)
./features/support/libs/ios.rb:1089:in `tapXpath'
./features/step_definitions/steps.rb:468:in `/^I tap on xPath "(.*?)"$/'
features/wallet/add_card_3ds.feature:35:in `Then I tap on xPath "//XCUIElementTypeButton[@name="Submit"]"'**
答案 0 :(得分:0)
我怀疑你可以在按钮元素中输入文字:
using System;
class MainMethod
{
static void Main(string[] args)
{
Customer Arley = new Customer("Praise", "Arley", "12 Hay Rd", 0412232116, "arleyp@gmail.com", DateTime(02,10,1990));
}
}
看起来像按钮的有效XPath定位器,但您需要为文本字段构建定位器
尝试搜索文本元素,可能类似
//XCUIElementTypeButton[@name="Submit"]
尽量不要在Appium / iOS上使用Xpath,因为它非常慢。