protractor CSS Selectors $ and $$ CSS selector locator shortcuts


Example


The Protractor API allows CSS element locators to use the jQuery-like shortcut notation $().

Normal CSS Element Locator:

element(by.css('h1.documentation-text[ng-bind="title"]'));
element(by.css('[ng-click="submit"]));

Shortcut $() CSS Element Locator:

$('h1.documentation-text[ng-bind="title"]');
$('[ng-click="submit"]');

For finding multiple elements under a locator use the shortcut notation $$().

Normal CSS Element Locator:

element.all(by.css('h1.documentation-text[ng-bind="title"]'));
element.all(by.css('[ng-click="submit"]));

Shortcut $$() CSS Element Locator:

$$('h1.documentation-text[ng-bind="title"]');
$$('[ng-click="submit"]');