i'm new cucumber tests. want in webpage contains button want click. tried possible ways are:
(1) driver.findelement(by.xpath("//button[contains(text(),'add new')]")).click();
(2) driver.findelement(by.linktext("add new")).click();
(3) driver.findelement(by.xpath("//button[@ng-click='addnewselection*']")).click();
(4) string str = driver.findelement(by.tagname("button")).getattribute("ng-click");
(5) string producthref = driver.findelement(by.partiallinktext("properties")).getattribute("href");
(6) driver.findelement(by.xpath("//html/body/header/nav/ol/li[2]/a")).click();
none of above worked. here html:
<button class="btn btn-default om-add-new-btn ng-binding" ng-click="addnewselection()">add new</button>
selenium makes awesome web driver cucumber tests, can rather wordy , complicated tool test steps.
i thoroughly recommend using capybara gem web related steps.
https://github.com/jnicklas/capybara
then, once configured, can use following code click button:
click_button('add new') i hope helps!
Comments
Post a Comment