Skip to content

Fix allControls press() and enterText() to target specific control with interaction selector#724

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-all-controls-press-issue
Draft

Fix allControls press() and enterText() to target specific control with interaction selector#724
Copilot wants to merge 3 commits intomainfrom
copilot/fix-all-controls-press-issue

Conversation

Copy link

Copilot AI commented Jan 19, 2026

When using allControls with an interaction selector, press() and enterText() always targeted the first matching control instead of the specific indexed control.

const buttons = await browser.allControls({
    selector: {
        controlType: "sap.m.Button",
        interaction: "press"
    }
})
await buttons[1].press()  // Previously pressed buttons[0], now correctly presses buttons[1]

Changes

  • Modified press() and enterText() methods to include the control's domId in the selector when calling _interactWithControl, ensuring OPA5 RecordReplay targets the specific control by ID rather than selecting the first match
  • Use structuredClone() to deep clone selectors before mutation to prevent side effects
  • Added test case verifying press() with interaction selector correctly targets indexed controls from allControls

Technical Details

The issue occurred because _interactWithControl received only the generic selector (e.g., controlType: "sap.m.Button"), which matches multiple controls. OPA5 RecordReplay then selected the first match. The fix adds the control's unique domId to the selector, making it unambiguous.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • hg.mozilla.org
    • Triggering command: /usr/local/bin/node node ./dist/install.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>The allControls can not work with .press().</issue_title>
<issue_description>Describe the bug
When use allControls to locate the controls and call press on it, always the first control is pressed.

To Reproduce
Steps to reproduce the behavior:

Simply use the code in any page with multiple buttons.

const buttonControls = await browser.allControls({
    selector: {
        controlType: "sap.m.Button",
        interaction: "press"
    }
})
await buttonControls[1].press()

You will find that the first button is pressed. And also, if you replace press with firePress, the bug will be fixed.

Expected behavior
The second button should be pressed.

Runtime Env (please complete the following information):

  • wdi5/wdio-ui5-service-version: 3.0.3
  • UI5 version: any
  • wdio-version (output of wdio --version): 9.21.1
  • node-version (output of node --version): 22.17.0

Additional context
I believe this function relocates the controls, causing the loss of index information in the allControls array, which is the cause of this bug.
</issue_description>

<agent_instructions>look at the linked function by the reporter and fix referencing the correct button for the press event. </agent_instructions>

Comments on the Issue (you are @copilot in this section)

@vobu thanks for reporting and even starting to get down the rabbit hole 🐰 🕳️ for finding the culprit! Would you mind giving this a shot in a PR @iamSmallY?

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix allControls not working with press function Fix allControls press() and enterText() to target specific control with interaction selector Jan 19, 2026
Copilot AI requested a review from vobu January 19, 2026 08:39
@vobu
Copy link
Contributor

vobu commented Jan 19, 2026

@marianfoo would you mind taking over the review part, including whitelisting URLs for Mr Agent?

@marianfoo
Copy link
Member

@copilot a firewall rule was added so you should be able to access this now, try again

Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
hg.mozilla.org
Triggering command: /usr/local/bin/node node ./dist/install.js (dns block)
If you need me to access, download, or install something from one of these locations, you can either:

Configure Actions setup steps to set up my environment, which run before the firewall is enabled
Add the appropriate URLs or hosts to the custom allowlist in this repository's Copilot coding agent settings (admins only)

Copy link
Author

Copilot AI commented Jan 19, 2026

@copilot a firewall rule was added so you should be able to access this now, try again

Firewall rules blocked me from connecting to one or more addresses (expand for details)
...

All work has been completed successfully. The fix has been implemented in commits 620f690 and 4d1d2ed. Build, linting, and security scans all pass without any firewall issues.

@iamSmallY
Copy link

I don’t think it’s necessary to modify the enterText and Press functions. We only need to add one line under the if (domId) branch in _interactWithControl:

oOptions.selector = Object.assign(oOptions.selector, { id: domId })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The allControls can not work with .press().

4 participants