0
当我添加一个具有某个值的新按钮时,它会动态添加到DOM中。此按钮无棱角HTML元素是:量角器中的动态属性值元素定位器
<li class="ui-state-default droppable ui-sortable-handle" id="element_98" data-value="2519">
25.19 EUR
<button type="button" class="btn btn-default removeParent">
<span class="glyphicon glyphicon-remove" aria-hidden="true">
</span>
</button>
</li>
一旦我删除此按钮,我要检查它不再存在。元素我在寻找为data-value="2519"
,这可能是任何东西我设置,例如像2000,1000,500,1050,...
在页面目标文件我曾尝试使用以下命令:
this.newValueButtonIsNotPresent = function(item) {
newValueButton = browser.element(by.id("containerQUICK_ADD_POINTS")).all(by.css('[data-value="' + item + '"]'));
return newValueButton.not.isPresent();
};
而且在规范文件中我调用这个函数如下:
var twentyEurosButtonAttributeValue = '2000';
describe("....
it ("...
expect(predefined.newValueButtonIsNotPresent(twentyEurosButtonAttributeValue)).toBeTruthy();
我知道这是不正确的,但我怎么能实现类似的东西或者有另一种方式?