Skip to content

Fixed the problem of finder or memory surge in multi-class situations#93

Open
Yyunfan wants to merge 1 commit intoantonmedv:masterfrom
Yyunfan:master
Open

Fixed the problem of finder or memory surge in multi-class situations#93
Yyunfan wants to merge 1 commit intoantonmedv:masterfrom
Yyunfan:master

Conversation

@Yyunfan
Copy link
Copy Markdown

@Yyunfan Yyunfan commented Jun 11, 2025

situation:
dom:

expect:
We need to get the selector as quickly as possible when using the finder library

@Yyunfan
Copy link
Copy Markdown
Author

Yyunfan commented Jun 11, 2025

dom case:<input id="s0-1-1-22-10-10-31-46-2-0-0-0-1-2-@dialog-16-1-9-0-0-2-0-0-10-0-0-2-0-0-11-se-textbox" class="textbox__control" type="text" value="" aria-invalid="true" style="padding-right: 34px;" aria-describedby="s0-1-1-22-10-10-31-46-2-0-0-0-1-2-@dialog-16-1-9-0-0-2-0-0-10-0-0-2-0-0-11-se-textbox-errors">

@Yyunfan
Copy link
Copy Markdown
Author

Yyunfan commented Jun 11, 2025

A lot of changes....

seedMinLength: 3,
optimizedMinLength: 2,
maxNumberOfPathChecks: Infinity,
maxNumberOfPathChecks: 50, // Much lower limit
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Isn't it too low?

while (current && current !== rootDocument) {
let totalGenerated = 0;

while (current && current !== rootDocument && i < 8) { // Limit depth
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Better to introduce config option

}

// Early exit if too many combinations
if (totalGenerated > 5000) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Same, lets have a configuration.

}
function wordLike(name) {
// Fast return for obviously generated IDs/classes (long or with numbers/special chars)
if (name.length > 30 || /\d{3,}/.test(name) || /@/.test(name)) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This looks pin pointing to your specific case. Can we just check for name.length?

@Yyunfan
Copy link
Copy Markdown
Author

Yyunfan commented Jun 11, 2025

@antonmedv Thanks for review. Do these changes match your expected design? Except for some configuration issues that need to be extracted. It still maintains the original library features right?

@antonmedv
Copy link
Copy Markdown
Owner

I guess, so. Main problem - selectors should be stable.

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.

2 participants