[英]Android Appium : Not able enter the text in textbox
//For log in scenario, I just want to enter the userID and password. //对于登录场景,我只想输入用户名和密码。 I tried with different Xpath but still it's not able to identify the box.
我尝试了不同的 Xpath 但仍然无法识别盒子。 every-time getting an no such element exception.
每次都没有这样的元素异常。 We are using testNG.
我们正在使用 testNG。
@AndroidFindBy(xpath = "XYZ")
public MobileElement txtUserName;
utils.EnterText(UserNameorMailId,txtUserName);
Different Xpath tried: xyz is placeholder.不同的 Xpath 试过:xyz 是占位符。
//*[@id='username']
//*[@text='Edit Text ; Email Address or Username']
//*[@id='layout_usename']//*[@text='Edit Text ; Email Address or Username']
Error message:错误信息:
Method threw 'org.openqa.selenium.NoSuchElementException' exception. Cannot evaluate io.appium.java_client.android.AndroidElement$$EnhancerByCGLIB$$34efbdcd.toString()
I am not sure what else I should try and what exactly the issue is...Help is really appreciated..我不确定我还应该尝试什么以及问题到底是什么......非常感谢帮助......
What's the exact error you are getting while entering text?您在输入文本时遇到的确切错误是什么? In case you are able to find the element Can you try to use ".//*[@text='Email Address or Username']"
如果你能找到元素你能尝试使用“.//*[@text='Email Address or Username']”吗
Can you try using AndroidElement
instead of MobileElement
?您可以尝试使用
AndroidElement
而不是MobileElement
吗? From the docs, I can see that MobileElement
is an abstract class which is inherited by AndroidElement
class, so using an object of an Abstract class may not work.从文档中,我可以看到
MobileElement
是一个抽象 class,它由AndroidElement
class 继承,因此使用抽象 ZA8CFDE6331BD59EB2AC96F8911C4B6666Z 的 ZA8CFDE6331BD59EB2AC96F8911C4B6666Z 可能不起作用。
MobileElement: https://appium.github.io/java-client/io/appium/java_client/MobileElement.html MobileElement: https://appium.github.io/java-client/io/appium/java_client/MobileElement.html
AndroidElement: https://appium.github.io/java-client/io/appium/java_client/android/AndroidElement.html AndroidElement: https://appium.github.io/java-client/io/appium/java_client/android/AndroidElement.html
Does clicking on the textbox produce the same error?单击文本框会产生相同的错误吗? Have you try setValue instead?
您是否尝试过 setValue ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.