FindElement returns itself instead of its child
Hello,
I want to send Keys to a textbox inside a combobox.
Problem is the combobox and descendant elements have the same Automation Id.
Inspect tool looks like this:
[This is part of the 'Open File Dialog' from Windows 10 which my program uses]
All three elements (pane, combo box and edit) have the Automation Id "1148"
I want to address the third one directly to send the .Clear() command before sending new Keys.
So what i came up with:
parentElement.FindElementByAccessibilityId("1148").FindElementByAccessibilityId("1148").FindElementByAccessibilityIdntByName("1148");
Sadly this is not working.
parentElement.FindElementByAccessibilityId("1148")
returns the exact same element as
parentElement.FindElementByAccessibilityId("1148").FindElementByAccessibilityId("1148").[...]
The issue is why can i find the element itself when searching for descendants?
Try SendKeys on the "Enter file name" pane once the dialog is shown. I faced a somewhat similar problem while writing automation scripts for testing of an Excel Add-In. I noticed that once the window is opened, the control goes to the file path textbox by default. I just waited for the dialog to show up with WebDriverWait and performed a send key on the main pop-up. It worked :)
I did try but it didn't work.
AppiumWebElement.SendKeys() or AppiumWebElement.Clear() wont work on the pane.
Using the actions did the trick:
var action = new Actions(Element.WrappedDriver);
action .Click(Element) .SendKeys(text) .Perform( );
Great! This one's resolved :)