microsoft / WinAppDriver

Windows Application Driver

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to identify the element

ritusenleo opened this issue · comments

commented

In the application after clicking a button , a dialog box appear from where a button need to be clicked.
Unable to identify the floating dialog box.

Tried the followings, but nothing worked:

  1. var dialog = driver.FindElementByName("XXXX");
    dialog.FindElementByAccessibilityId("6").Click();

  2. var appiumOptions = new AppiumOptions();
    var _configurationDriver = new ConfigurationDriver();
    appiumOptions.AddAdditionalCapability("app", "Root");
    string appSetting = _configurationDriver.Configuration["winAppUri"];
    var remoteAddress = new Uri(appSetting);
    var driverRoot = new WindowsDriver(remoteAddress, appiumOptions);
    var dialog = driverRoot.FindElementByName("XXXX");
    dialog.FindElementByAccessibilityId("6").Click();

  3. string topWindow = driverRoot.FindElementByName("XXXX").GetAttribute("NativeWindowHandle");
    int MAWinHandleInt = Int32.Parse(topWindow);
    string MAWinHandleHex = MAWinHandleInt.ToString();
    Console.WriteLine("Success2");
    var apOpt = new AppiumOptions();
    apOpt.AddAdditionalCapability("appTopLevelWindow", MAWinHandleHex);
    var drv = new WindowsDriver(remoteAddress, apOpt);
    drv.FindElementByAccessibilityId("6").Click();

Any suggestion please

Your code is correct. I don't find any reason for it not to work. Can you get the page source.

commented

@anunay1 can we please connect, it will be easy for me ....

Were you able to solve this? if not send a zoom call request.

commented
commented

it is solved after the fix.

But what did they fix.

commented