* Creates a condition that will wait for the current page's title to match the * given regular expression. * * @param {!RegExp} regex The regular expression to test against. * @return {!Condition } The new condition.
(regex)
| 165 | * @return {!Condition<boolean>} The new condition. |
| 166 | */ |
| 167 | function titleMatches(regex) { |
| 168 | return new Condition('for title to match ' + regex, function (driver) { |
| 169 | return driver.getTitle().then(function (title) { |
| 170 | return regex.test(title) |
| 171 | }) |
| 172 | }) |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Creates a condition that will wait for the current page's url to match the |