c# - OpenQA.Selenium.ElementNotInteracable - 无法到达元素
问题描述
我不知道为什么我的代码看不到第二个输入。将文本添加到第一个输入时成功接收OpenQA.Selenium.ElementNotInteracable: Element input.k-formatted-value.ng-pristine.ng-untouched.ng-valid.k-input is not reachable by keyboard
错误。
By inputOneSrc = By.CssSelector("input.invalid");
By inputTwoSrc = By.CssSelector("input.k-formatted-value.ng-pristine.ng-untouched.ng-valid.k-input");
IWebElement inputFirst = driver.findElement(inputOneSrc);
IWebElement inputSecound = driver.findElement(inputTwoSrc);
inputFirst.SendKeys("abc");
inputSecound.SendKeys("cba");
在将文本发送到inputFirst后,我尝试使用Clear() ,但仍然无法将文本添加到第二个输入。我认为这个文本以某种方式隐藏,因为我可以看到它使用:
inputFirst.GetAttribute("value");
inputSecound.GetAttribute("value");
但不能只使用 Text()。您知道如何解决它以查看输入中的文本吗?
<input type="text" class="k-formatted-value ng-pristine ng-untouched ng-valid k-input" title="" tabindex="0" role="spinbutton" aria-valuemin="-999999999999999" aria-valuemax="999999999999999" aria-title="" aria-valuenow="" aria-disabled="false" aria-readonly="false" style="display: inline-block;">
<input next-focus="" kendo-numeric-text-box="c.numeric" k-options="numericOptions" ng-model="c.Value" style="display: none;" ng-class="{'flow-required': !c.AllowEmpty}" required="" class="ng-pristine k-input ng-invalid ng-invalid-required flow-required invalid ng-touched" data-role="numerictextbox" role="spinbutton" type="text" aria-valuemin="-999999999999999" aria-valuemax="999999999999999" aria-valuenow="" aria-disabled="false" aria-readonly="false">
<input type="text" class="k-formatted-value ng-pristine ng-untouched ng-valid k-input" title="" tabindex="0" role="spinbutton" aria-valuemin="-999999999999999" aria-valuemax="999999999999999" aria-title="" aria-valuenow="" aria-disabled="false" aria-readonly="false" style="display: inline-block;">
<input next-focus="" kendo-numeric-text-box="c.numeric" k-options="numericOptions" ng-model="c.Value" style="display: none;" ng-class="{'flow-required': !c.AllowEmpty}" required="" class="ng-pristine k-input ng-invalid ng-invalid-required flow-required invalid ng-touched" data-role="numerictextbox" role="spinbutton" type="text" aria-valuemin="-999999999999999" aria-valuemax="999999999999999" aria-valuenow="" aria-disabled="false" aria-readonly="false"><span class="k-select">
解决方案
推荐阅读
- python - xarray DataSet 作为时间不兼容时间序列的容器
- typescript - 如何通过打字稿中的中间函数传递接口类型?
- mysql - 在mysql中使用纪元日期检索记录
- firebase - 我使用 Firebase Flutter 中的提供程序连接到我的应用程序
- java - 如何在 Spring Cloud Contract Groovy DSL Contract 定义中将请求主体对象属性定义为可为空?
- python - 如何计算列表中特定类型的出现次数?
- python - 在 PysimpleGUI 的输入中输入文本后,如何自动将光标置于输入文本的末尾?
- c# - 模型不绑定在 POST 控制器方法.Net Core MVC
- c# - AES 大块解密在末尾添加随机字节
- azure - Azure 计算机视觉为带有矢量图形的 pdf 返回垃圾