在页列有这样的:量角器,获得通过CSS计数不工作
<span translate="" class="ng-scope ng-binding">Number of Products</span>
<span translate="" class="ng-scope ng-binding">Number of Processed Products</span>
number of preprocessed Products
number of Products
所以,检查页面,如果它存在,我尝试检查这些列被激活。
所以,我这样做:
var el = element.all(by.css("Products</span>"));
var EC = protractor.ExpectedConditions;
browser.wait(EC.presenceOf(el), 5000);
但错误是
Message:
Failed: Cannot read property 'bind' of undefined
Stack:
TypeError: Cannot read property 'bind' of undefined
at ProtractorExpectedConditions.presenceOf (/usr/lib/node_modules/protractor/built/expectedConditions.js:354:39)
,所以我改变这个
var EC = protractor.ExpectedConditions;
// browser.wait(EC.presenceOf(el), 1000);
browser.wait(EC.visibilityOf(element(by.
cssContainingText('span', 'Products'))), 5000); // maximum wait of 5 seconds
expect((element(by.cssContainingText('span', 'Products'))).count()).toEqual(1);
但错误是
Message:
Failed: element(...).count is not a function
当我做到这一点
var el = element(by.cssContainingText('span', 'Products'));
var EC = protractor.ExpectedConditions;
browser.wait(EC.presenceOf(el), 5000); // maximum wait of 5 seconds
expect(el.count()).toEqual(1);
eror是
Message:
Failed: element(...).count is not a function
var el = element.all(by.css("Products"));
var EC = protractor.ExpectedConditions;
browser.wait(EC.visibilityOf(el), 1000);
expect(el.count()).toEqual(1);
此错误
Failed: Cannot read property 'bind' of undefined
是同为 '' 或 “”
你最终想达到什么目的? –
“bind”的错误是因为这些不是有效的定位器。当你传递'element(by.css(“Products”))'时,它正在寻找标签,因为那是你指定的。与'element.all(by.css(“Products”))一样''...那不是你如何在定位器中包含标记。您应该查看CSS定位器的工作方式 –
Gunderson