(locator, context = null, options = {})
| 3090 | } |
| 3091 | |
| 3092 | async function proceedClick(locator, context = null, options = {}) { |
| 3093 | let matcher = await this.context |
| 3094 | if (context) { |
| 3095 | const els = await this._locate(context) |
| 3096 | assertElementExists(els, context) |
| 3097 | matcher = els[0] |
| 3098 | } |
| 3099 | const els = await findClickable.call(this, matcher, locator) |
| 3100 | if (context) { |
| 3101 | assertElementExists(els, locator, 'Clickable element', `was not found inside element ${new Locator(context).toString()}`) |
| 3102 | } else { |
| 3103 | assertElementExists(els, locator, 'Clickable element') |
| 3104 | } |
| 3105 | const el = selectElement(els, locator, this) |
| 3106 | |
| 3107 | highlightActiveElement.call(this, el, await this._getContext()) |
| 3108 | |
| 3109 | await el.click(options) |
| 3110 | const promises = [] |
| 3111 | if (options.waitForNavigation) { |
| 3112 | promises.push(this.waitForNavigation()) |
| 3113 | } |
| 3114 | promises.push(this._waitForAction()) |
| 3115 | |
| 3116 | return Promise.all(promises) |
| 3117 | } |
| 3118 | |
| 3119 | async function findClickable(matcher, locator) { |
| 3120 | const matchedLocator = new Locator(locator) |
nothing calls this directly
no test coverage detected