使用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' –