在Appium上出错,无法将元素设置为'value'。您是否与正确的元素进行了互动?

问题描述 投票:0回答:1

我正在使用appium进行应用程序的自动化。我可以吃午餐,但可以登录,它可以读取XPath进行登录。但是appium无法输入手机号码。对于移动设备,我正在使用模拟器。

这是我的代码:

driver.findElement(By.xpath(props.getProperty("mobile"))).sendKeys("123456");

这是我的Xpath:

mobile=//android.widget.EditText[@text='Mobile']

面对错误:

遇到内部错误运行命令:io.appium.uiautomator2.common.exceptions.InvalidElementStateException:无法将元素设置为'value'。您是否与正确的元素进行了互动?

android-emulator appium-android
1个回答
0
投票

[不确定为什么要使用props.getProporty或尝试使用它,您可以直接在driver.findElement()中使用xpath

driver.findElement(By.xpath("//android.widget.EditText[@text='Mobile']")).sendKeys("123456");
© www.soinside.com 2019 - 2024. All rights reserved.