问题描述
我正在从事移动自动化项目,但是在获取属性值时遇到问题(例如,如果选中了单选按钮,或者未选中的复选框,则为单选按钮)。我正在使用By org.openqa.selenium.By
类,但是我发现该类不像isEnabled()
这样的方法被计数,而像getText()
那样被Checked()和Webdriver
占用,而将其强制转换为SearchContext类以获取属性值时出错。
ExamplePage.locationSharingSwitch.findElement((SearchContext);
ExamplePage.locationSharingSwitch).isEnabled();
遇到此错误
java.lang.ClassCastException:org.openqa.selenium.By $ ByXPath不能为 强制转换为org.openqa.selenium.SearchContext
有什么建议吗?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)