Skip to content

Conversation

AlinaVarkki
Copy link
Collaborator

Fixes #185

The standard selector value is not included in the AXNode, so add it separately.

@AlinaVarkki AlinaVarkki requested a review from OrKoN October 1, 2025 11:58
Copy link
Collaborator

@OrKoN OrKoN left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Let us use conventional commits for the PR title.

I think we should do the approach we discussed previously in which we resolve option label to a value when we will out an option. WDYT? I think doing evals during snapshot generation would be too expensive and bug-prone

@AlinaVarkki
Copy link
Collaborator Author

Thanks! Let us use conventional commits for the PR title.

I think we should do the approach we discussed previously in which we resolve option label to a value when we will out an option. WDYT? I think doing evals during snapshot generation would be too expensive and bug-prone

Do you mean check if it is an option within fill_form and get the value then?
We can do that, but do you think there is no other case when we might need the value in the snapshot?
Maybe for some other tool to use?

@AlinaVarkki AlinaVarkki changed the title Add an option value to the snapshot fix: add an option value to the snapshot Oct 2, 2025
if (aXNode && aXNode.role === 'combobox' && aXNode.children) {
for (const child of aXNode.children) {
if (child.role === 'option' && child.name === value && child.value) {
const childHandle = await child.elementHandle();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need to dispose the child handle after we use it

}
break;
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should throw an error if no option was found

// To do that, loop through the children while checking which child's text matches the requested value (requested value is actually the text content).
// When the correct option is found, use the element handle to get the real value.
const aXNode = context.getAXNodeByUid(uid);
if (aXNode && aXNode.role === 'combobox' && aXNode.children) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we could extract the logic for finding an option in a combobox into a helper function?

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.

Cannot select <select> option by text
2 participants