Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BugFix - 40481 - Disable ByTagName Locator If No Friendly Locator Available #3824

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,20 @@ public async Task<List<ElementInfo>> GetVisibleControls(PomSetting pomSetting, O
POMLearner pomLearner = POMLearner.Create(pageSource, new PlaywrightBrowserElementProvider(currentTab), pomSetting, xpathImpl: this);
await pomLearner.LearnElementsAsync(foundElementsList);

//below part should ideally be handled in POMLearner itself but, when we add the learned element to the observable list, it sets the active status as true again
foreach (ElementInfo element in foundElementsList)
{
HTMLElementInfo htmlElementInfo = (HTMLElementInfo)element;
if (htmlElementInfo.FriendlyLocators.Count == 0 && htmlElementInfo.Locators.Count >= 1)
{
ElementLocator? byTagNameLocator = htmlElementInfo.Locators.FirstOrDefault(l => l.LocateBy == eLocateBy.ByTagName);
if (byTagNameLocator != null)
{
byTagNameLocator.Active = false;
}
}
}

return new(foundElementsList);
}

Expand Down
Loading