#15540·webdriverio

[ Bug]: `multiRemoteBrowser.addLocatorStrategy` throws `scope.strategies.get is not a function`

Author: dprevost-LMICreated Aug 28, 2026Updated Aug 29, 2026
LabelsBug 🐛multi remote

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

latest

Mode

Standalone Mode

Which capabilities are you using?

typescript
N/A

What happened?

Adding a LocatorStrategy on a multi-remote browser throws scope.strategies.get is not a function. It sounds like this is not supported. Moreover, not sure how this should behave, or if it should just not exist...

What is your expected behavior?

Either it does not crash, or addLocatorStrategy is not on the interface since it is not a thing

How to reproduce the bug.

typescript
                it('should addLocatorStrategy on multi-remote', async () => {
                    multiRemoteBrowser.addLocatorStrategy('selectHeader', (selector: any) => document.querySelector(selector) as HTMLElement)
                })

Relevant log output

typescript
TypeError: scope.strategies.get is not a function
    at MultiRemoteDriver.addLocatorStrategy (webdriverio/packages/webdriverio/build/node.js:9926:26)
    at Context.<anonymous> (webdriverio/e2e/wdio/headless/multiRemoteTest.e2e.ts:322:40)
    at Context.executeAsync (webdriverio/packages/wdio-utils/build/index.js:1133:10)
    at Context.testFrameworkFnWrapper (webdriverio/packages/wdio-utils/build/index.js:1213:34)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Potential Fix

The below changes around https://github.com/dprevost-LMI/webdriverio/blob/5a12a5e5b341cda14d3076f8f48a19da7f8f8a83/packages/webdriverio/src/multiremote.ts#L78, fixes the issue but the question is more: how should locator strategy behavior on multi-remote before fixing this issue

typescript
        // Fixes `Cannot read properties of undefined (reading 'get')`
        const strategies = wrapperClient.__propertiesObject__.strategies?.value
        propertiesObject.strategies = {
            value: strategies instanceof Map ? strategies : new Map()
        }

        for (const commandName of wrapperClient.commandList) {
            // Fixes `scope.strategies.get is not a function`
            if (typeof wrapperClient[commandName] !== 'function') {
                continue
            }

            propertiesObject[commandName] = {
                value: this.commandWrapper(commandName),
                configurable: true
            }
        }