下面是源代碼,兩個按鈕:如何查找按鈕
<div class="picker__footer">
<button class="picker__button--clear" type="button" data-pick="1411929000000" aria-controls="start-date"> :: before "Today" </button>
<button class="picker__button--clear" type="button" data-clear="1" aria-controls="start-date"> :: before "Close" </button>
</div>
我想在第二個按鈕點擊不使用XPath,其實我只想要使用這些定位器中的任何一個(http://angular.github.io/protractor/#/api?view=ProtractorBy)。是否有可能在量角器中沒有Xpath的情況下處理這些類型的元素?
有什麼方法可以指定'data-clear'屬性的值。我希望將它作爲'element(by.css('button [data-clear = 1]'))。click();'。所以,如果兩個webelements具有相同的屬性,那麼我可以通過指定相同屬性的值來使css唯一。 – 2014-10-09 06:41:57
我相信你在那裏寫的應該很好。 – 2014-10-09 17:29:22
是我上面寫的作品 – 2014-10-10 04:49:24