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

[dotnet] store the mutated element for the user not just the target id #12948

Merged
merged 2 commits into from
Oct 16, 2023

Conversation

titusfortner
Copy link
Member

@titusfortner titusfortner commented Oct 13, 2023

Description

When an element is mutated it returns the ID of the element, this stores that element in the representative Data class instead of just the target ID.

Motivation and Context

  • The other languages do it.
  • It's not obvious to the user how to get the information

Required now:

            var mutations = new List<IWebElement>();
            using IJavaScriptEngine monitor = new JavaScriptEngine(driver);
            monitor.DomMutated += (sender, e) =>
            {
                var locator = By.CssSelector($"*[data-__webdriver_id='{e.AttributeData.TargetId}']");
                mutations.Add(driver.FindElement(locator));
            };

Desired:

            var mutations = new List<IWebElement>();
            using IJavaScriptEngine monitor = new JavaScriptEngine(driver);
            monitor.DomMutated += (sender, e) =>
            {
                mutations.Add(e.Element);
            };

Java:

    CopyOnWriteArrayList<WebElement> mutations = new CopyOnWriteArrayList<>();
    ((HasLogEvents) driver).onLogEvent(domMutation(e -> mutations.add(e.getElement())));

Ruby:

    mutations = []
    driver.on_log_event(:mutation) { |mutation| mutations << mutation.element }

@titusfortner
Copy link
Member Author

There are a few places where the Args template isn't storing the useful information but I do not want to spend time on any of this if we can start pushing the actual BiDi spec. Actually, it probably is forward compatible the way it is written. We can add the more useful things with the correct classes in the next implementation. Just frustrating right now. :)

@titusfortner titusfortner merged commit ae0d894 into trunk Oct 16, 2023
10 checks passed
@titusfortner titusfortner deleted the mutate_element branch October 16, 2023 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants