使用Firefox和标记在我的web应用程序的链接中的其他事情,我得到的,这个代码,我想我可以用它来caprture对象:硒和捕捉对象
cb_or_somename_someothername cb_area_0219
此字符串是“类名”在Firebug。 要我输入脚本:
WebElement rolle = driver.findElement(By.className("cb_or_somename_someothername cb_area_0219"));
但在执行时,脚本没有找到的元素。
其他onfo在Firebug的面板是:
class="cb_or_somename_someothername cb_area_0219"
onclick="jsf.util.chain(this,event,'$(this).attr(\'disabled\', \'disabled\');return true;','mojarra.jsfcljs(document.getElementById(\'fwMainContentForm\'),{\'fwMainContentForm:j_idt156:2:selectRole \':\'fwMainContentForm:j_idt156:2:selectRole\'},\'\')');return false"
href="#"
id="fwMainContentForm:j_idt156:2:selectRole"
是我的脚本参考元素以错误的方式?
您是否得到了'ElementNotFoundException'或关于复合类名称的异常? – Andersson
引起:org.openqa.selenium.InvalidSelectorException:给定的选择器cb_or_somename_someothername cb_area_0219无效或不导致WebElement。发生以下错误: InvalidSelectorError:不允许使用复合类名称 有关此错误的文档,请访问:http://seleniumhq.org/exceptions/invalid_selector_exception.html 构建信息:版本:'2.53.1',revision: 'a36b8b1cd5757287168e54b817830adce9b0158d',时间:'2016-06-30 19:26:09' –