* 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)
| 167 | * @return {!Condition<boolean>} The new condition. |
| 168 | */ |
| 169 | function titleMatches(regex) { |
| 170 | return new Condition('for title to match ' + regex, function (driver) { |
| 171 | return driver.getTitle().then(function (title) { |
| 172 | return regex.test(title) |
| 173 | }) |
| 174 | }) |
| 175 | } |
| 176 | |
| 177 | /** |
| 178 | * Creates a condition that will wait for the current page's url to match the |