当我尝试在XPath中使用文本时,出现错误
org.openqa.selenium.InvalidSelectorException: Argument was an invalid selector (e.g. XPath/CSS). (WARNING: The server did not provide any stacktrace information)"
这是我试图找到一个元素的代码
driver.findElement(By.xpath("//android.widget.EditText[@text=‘Enter recipient. Editing.’]")).sendKeys("8659741253");
最佳答案
问题出在文本编辑器上。 “”字符不是预期的单引号。因此,请使用普通的“”。
希望这会起作用。
关于selenium - Appium无法使用UIAutomator中的文本在移动应用程序中定位元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48295864/