Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 624 Bytes

no-by-xpath.md

File metadata and controls

21 lines (14 loc) · 624 Bytes

Discourage the use of by.xpath() locator

Ensure by.xpath locator is not used.

Rule details

According to the Protractor's style guide, using by.xpath is considered a bad practice.

👎 The following patterns are considered warnings:

element(by.xpath("//a[starts-with(@href, 'something')]"));
element.all(by.xpath("//a[starts-with(@href, 'something')]"));

👍 The following patterns are not warnings:

element(by.css("a[href^=something]"));
element.all(by.css("a[href^=something]"));