連接按鈕的代碼是:
<div style="position: absolute; right: 0; top: 0;">
<button class="prev btn btn-warning disabled" style="padding: 4px 8px;">
<i class="fa fa-chevron-left" style="margin: 0"/>
</button>
<button class="next btn btn-warning" style="padding: 4px 8px;">
<i class="fa fa-chevron-right" style="margin: 0"/>
</button>
</div>
我如何檢查我想哪一個是使用氦氣 使下面的代碼
click("Home");
if(Button(">").isEnabled()){
click($("html/body/div[6]/div/h3/div/button[2]"));
}
else{
click($("html/body/div[6]/div/h3/div/button[1]"));
}
但有以下錯誤
Exception in thread "main" org.openqa.selenium.NoSuchElementException: Cannot find element ButtonImpl(">"). For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html Build info: version: '2.45.0', revision: '5017cb8e7ca8e37638dc3091b2440b90a1d8686f', time: '2015-02-27 09:10:26' System info: host: 'Keya-PC', ip: '172.16.0.144', os.name: 'Windows 7', os.arch: 'amd64', os.version: '6.1', java.version: '1.8.0_25' Driver info: driver.version: unknown at com.heliumhq.api_impl.GUIElementImpl.perform(GUIElementImpl.java:107) at com.heliumhq.api_impl.GUIElementImpl.bindToFirstOccurrence(GUIElementImpl.java:94) at com.heliumhq.api_impl.GUIElementImpl.getFirstOccurrence(GUIElementImpl.java:89) at com.heliumhq.api_impl.ButtonImpl.isEnabled(ButtonImpl.java:26) at com.heliumhq.API$Button.isEnabled(API.java:1276) at searchHomePage.search(searchHomePage.java:30) at mainClass.main(mainClass.java:19)
將不勝感激的幫助。
請您詳細說明 –