Is it possible to get an element by its name like you can with jQuery? I'm trying to do the equivalent of the jQuery selector like in jQuery
$('h1')
how is this done with protractor?
I tried
element('h1')
but it doesn't work
Is it possible to get an element by its name like you can with jQuery? I'm trying to do the equivalent of the jQuery selector like in jQuery
$('h1')
how is this done with protractor?
I tried
element('h1')
but it doesn't work
有几种方法可以做到这一点 - 您可以通过 tagName 或 css 选择器获取它。因此,以下任何一项工作:
element(by.css('h1')); // works with any css selector
$('h1'); // works with any css selector
element(by.tagName('h1'));
答案终于在github上找到了,他们有一个测试文件,显示了所有的选择器
element(by.css('h1'));
element(by.css('.my-class'));