* Adds condition: attribute value contains text * (analog of XPATH: [contains(@attr,'partOfAttribute')] or CSS [attr*='partOfAttribute'] * Example: I.click(locate('a').withAttrContains('href', 'google'))); * Works with any attribute: class, href etc. * @param {string} attrName * @para
(attrName, partOfAttrValue)
| 374 | * @returns {Locator} |
| 375 | */ |
| 376 | withAttrContains(attrName, partOfAttrValue) { |
| 377 | const xpath = sprintf('%s[%s]', this.toXPath(), `contains(@${attrName}, "${partOfAttrValue}")`) |
| 378 | return new Locator({ xpath }) |
| 379 | } |
| 380 | |
| 381 | /** |
| 382 | * Find an element with all of the provided CSS classes (word-exact match). |