Having issues in automate desktop application using winium c# . Not able to click on the Open button in Windows Open dialog attached

0

Its the first time I am using Winium . I am having issues in getting a code to click on the Open button in the Windows Open dialog. There are 2 same names Open for the dialog and the Open button. I was using the below code :

        var sitesRoot = GetElementByName(driver, "Sites", 10000);
        if (sitesRoot != null)
        {

            sitesRoot.Click();
        }
        else
        {
            Console.WriteLine("did not find");
        }

        Console.WriteLine("Backup is Opened ");


        Actions builder = new Actions(driver);
        builder.ContextClick(sitesRoot).Build().Perform();

        IWebElement restoreSite = driver.FindElementByName("Restore Site");

        restoreSite.Click();


        IWebElement filePath = driver.FindElementByName("File name:");
        filePath.SendKeys("C:\\CXpro1010B25NEW\\SiteBackup\\CBX12.CXB");

var openDialog = GetElementById(driver, "1", 10000);
        if (openDialog != null)
        {
            openDialog.Click();
        }
        else
        {
            Console.WriteLine("did not find Open");
        }

        Console.WriteLine("Ready to start testing");

I could see that the Open name is showing on the top of the dialog and on the button. So I feel its getting confusing. I can enter the path in the file name but not able to click on Open button . I also tried with key strokes because it could open also using ALT+o but not sure how to

enter image description here

Could someone help please?

tester

Posted 2019-08-28T14:07:26.310

Reputation: 1

No answers