* Adds condition: attribute value ends with text * (analog of XPATH: [ends-with(@attr,'endValue')] or CSS [attr$='endValue'] * Example: I.click(locate('a').withAttrEndsWith('href', '.com'))); * Works with any attribute: class, href etc. * @param {string} attrName * @param {string} end
(attrName, endsWith)
| 360 | * @returns {Locator} |
| 361 | */ |
| 362 | withAttrEndsWith(attrName, endsWith) { |
| 363 | const xpath = sprintf('%s[%s]', this.toXPath(), `substring(@${attrName}, string-length(@${attrName}) - string-length("${endsWith}") + 1) = "${endsWith}"`) |
| 364 | return new Locator({ xpath }) |
| 365 | } |
| 366 | |
| 367 | /** |
| 368 | * Adds condition: attribute value contains text |