mardi 2 juin 2015

How do I check enable and disabled button using helium?

enter image description here

The code of attached button is:

<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>

How can I check that which one is enable using helium I tried the following code

        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]"));
        }

But got the following error

Exception in thread "main" org.openqa.selenium.NoSuchElementException: Cannot find element ButtonImpl(">"). For documentation on this error, please visit: http://ift.tt/1c3pd29 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)

Would appreciate the help.

Aucun commentaire:

Enregistrer un commentaire