I am trying to automate Windows app using Win app driver, How can we select item from the list using java?
WindowsElement comboBoxElement1= (WindowsElement) DesktopSession.findElementsByXPath("//List[@Name='Select Outlet:']//*[starts-with(@AutomationId,'listBox')]");
comboBoxElement1.findElementByName("!xyz").click();
I am getting error as not being able to locate the element. Also most of the cases findElementByXpath
is not working.
UI looks as below:
use sendkeys:
comboBoxElement1.SendKeys("name of the item");
UPDATE
comboBox.Click();
string xPathListItem = $"//Text[contains(@Name, '{dateTom}')]/preceding::Custom[1]/ComboBox/ListItem[1]"; //xPath of your item in combobox
elem = (WindowsElement)window.FindElementByXPath(xPathListItem);
app.DoubleClick(elem);
here is my DoubleClick method:
public void DoubleClick(WindowsElement elem)
{
session.Mouse.MouseMove(elem.Coordinates);
session.Mouse.DoubleClick(null);
}