我可以在量角器中使用 '>' css 选择器吗?
can i use '>' css selector in protractor?
我该如何解决这个问题?这部分测试将不基于 Angular。
function Menu(container) {
this.container = container;
this.elements = this.getItems();
}
Menu.prototype.getItems = function() {
var arr = this.container.$('> li');
...
};
谢谢大家!
您可以使用 :scope
实验性 CSS 选择器(不适用于 IE):
The :scope CSS pseudo-class matches the elements that are a reference
point for selectors to match against.
this.container.$(":scope > li");
或者,您可以使用 by.xpath()
locator:
this.container.element(by.xpath("./li"));
我该如何解决这个问题?这部分测试将不基于 Angular。
function Menu(container) {
this.container = container;
this.elements = this.getItems();
}
Menu.prototype.getItems = function() {
var arr = this.container.$('> li');
...
};
谢谢大家!
您可以使用 :scope
实验性 CSS 选择器(不适用于 IE):
The :scope CSS pseudo-class matches the elements that are a reference point for selectors to match against.
this.container.$(":scope > li");
或者,您可以使用 by.xpath()
locator:
this.container.element(by.xpath("./li"));