0

I have a list that used to show different kinds of profile status. The status maybe like passed, failed, attention, reading and so on.

In Chrome inspector, I could use Jquery syntax to locate the list.

$('div > div > li > div:has(span.passed, span.failed, span.attention, span.reading)')

and the length is correct. But in Protractor spec, I tried to use the same, It always report error. What I write in the protractor below:

element.all(by.css('div > div > li > div:has(span.passed, span.failed, span.attention, span.reading)')).count().then(function (count) {
      console.log(count);
});

Can someone help to answer what is the problem here?

Thanks

Boyka Zhu
  • 391
  • 1
  • 4
  • 18

1 Answers1

0

Using '$' has a different meaning in console and in Protractor.

When you use '$' in console - you are using jQuery. In protractor it has a different meaning - it is 'by.css' (has you tried to use).

You could try using xpath maybe or 'by.css' differently.

user2880391
  • 2,683
  • 7
  • 38
  • 77
  • Thanks. That what I did to use by.css() in Protractor to instead $ in JQuery console. But seems like the ":has" is not good support with by.css(). I am trying to use by.xpath to handle it – Boyka Zhu Apr 26 '16 at 01:30