How to access popup window outside of WinAppDriver Appium WinForm in C#?

29 Views Asked by At

My win app is "Gyro Multi Vendor SPEAR - Version 6.20.14". normal WinAppDriverUIRecorder XML Nodes has my win app included, so I can access.

<UiTask task="Inspect" x="154" y="619">
  <Pane LocalizedControlType="pane" ClassName="#32769" Name="Desktop 1" AutomationId="" x="0" y="0" width="3840" height="2160" Pos=""/>
  <Window LocalizedControlType="window" ClassName="WindowsForms10.Window.8.app.0.29531c8_r8_ad1" Name="Gyro Multi Vendor SPEAR - Version 6.20.14  -Development Version" AutomationId="MainControl" x="1155" y="495" width="1530" height="1110" Pos="4"/>
  <Window LocalizedControlType="window" ClassName="WindowsForms10.Window.8.app.0.29531c8_r8_ad1" Name="Default Tool Parameters" AutomationId="ParametersDefaultsForm2" x="1304" y="650" width="1233" height="800" Pos=""/>
</UiTask>

But I have a pop up window which does not include my win app name, how to use FindElementByAccessibilityId or FindElementByName etc. to access?

<UiTask task="Inspect" x="374" y="847">
  <Pane LocalizedControlType="pane" ClassName="#32769" Name="Desktop 1" AutomationId="" x="0" y="0" width="3840" height="2160" Pos=""/>
  <Window LocalizedControlType="dialog" ClassName="#32770" Name="Browse For Folder" AutomationId="" x="1670" y="804" width="978" height="888" Pos="4"/>
</UiTask>

my C# code:

public class SPEAR_MVTest
{
    static WindowsDriver<WindowsElement> sessionWinForm;
    static private int client_type = 0;

    [ClassInitialize]
    public static void Init(TestContext testContext)
    {
        AppiumOptions dcWinForms = new AppiumOptions();
        dcWinForms.AddAdditionalCapability("app",
        "@C:\Program Files\Gyrodata\Gyro MV SPEAR Dev\Gyro MV Spear.exe");  
        sessionWinForm = new WindowsDriver<WindowsElement>(new Uri("http://127.0.0.1:4723"), dcWinForms);

    }
}

I use var folder_win = sessionWinForm.FindElementByName("Browse For Folder");

error: OpenQA.Selenium.WebDriverException: An element could not be located on the page using the given search parameters.

0

There are 0 best solutions below