我已经使用 id
进入了 textarea,但数据是来自 Angular http 客户端的异步数据:
<textarea id="fullJson" ng-model="response.payload"></textarea>
有些文本是在页面加载时手写的。假设我们将编写“
<abc>foo</abc>
”。在我的java代码中,我使用这个:
ExpectedConditions.presenceOfElementLocated(...)
问题很简单:
如何在我的 XPath 中使用添加 XML 字符:
//textarea[@id='fullJson']
我尝试这个但不起作用:
//textarea[@id='fullJson' and contains(@value, '<')]
我尝试这个但不起作用:
//textarea[@id='fullJson' and contains(@value, 'abc')]
最佳答案
试试这个:
//textarea[@id='fullJson' and (@ng-model = "response.payload")]
或者
//*textarea[@id='fullJson' and (@ng-model = "response.payload")]
如果仍有问题,请上传完整的 html 代码!
关于selenium - XPath 使用包含值的文本区域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59626082/