//private int paramPierwszeRuchomePole;

        public SilverlightTableEditorWindow(WebDocument openWebsite, int?browserId, string idOkna = "", bool ignoreHeader = false, bool detailsPresenter = false, int ktoraTabelka = 0, bool emptyWindow = false, bool znajdzWKontenerze = true)
            : base(openWebsite, browserId)
        {
            _znajdzWKontenerze = znajdzWKontenerze;
            WaitForLoadInWindow();
            if (idOkna != "")
            {
                _okno = OpenWebsite.FindSingle <Form>(string.Format(".//form/form[@name='{0}' and @visible='true']", idOkna));
            }
            if (idOkna == "")
            {
                _okno = OpenWebsite.FindSingle <Form>(string.Format(".//form/form[@visible='true']"));
            }
            if (_znajdzWKontenerze)
            {
                _container = _okno.FindSingle <Container>(".//container[@automationid='scrollViewer' and @visible='true']");
            }
            if (!emptyWindow)
            {
                InternalTable = PobierzTabelkeDoEdycji(detailsPresenter, ignoreHeader, ktoraTabelka);
            }

            paramDetailsPresenter = detailsPresenter;
            paramIgnoreHeader     = ignoreHeader;
            paramKtoraTabelka     = ktoraTabelka;
        }
예제 #2
0
        public void CheckFileFolderExist(string path)
        {
            // press Window E open file explorer
            Ranorex.Keyboard.Press("{LWin down}e{LWin up}");
            Delay.Milliseconds(1000);

            System.Diagnostics.Debug.WriteLine(path);
            // split path into item
            string[] dir = path.Split('\\');
            string   fileExplorerXpath = null;

            for (int i = 0; i < dir.Count(); i++)
            {
                System.Diagnostics.Debug.WriteLine(dir[i]);
                if (i == 0)
                {
                    repo.Explorer.ToolBar1001.Click();
                    Ranorex.Keyboard.Press(dir[i]);
                    Ranorex.Keyboard.Press("{Return}");
                    fileExplorerXpath = "/form[@processname='explorer' and @title~'" + "(" + dir[i] + ")']";
                }
                else
                {
                    // find file explorer
                    Ranorex.Form         fileExplorer = null;
                    Ranorex.Core.Element element      = Host.Local.FindSingle(fileExplorerXpath, 5000);
                    if (element != null)
                    {
                        fileExplorer = element;
                    }
                    // check if folder exist
                    string folderXpath = "element[@class='ShellTabWindowClass']//element[@instance='1']/container[@caption='ShellView']/list/listitem[@text='" + dir[i] + "']";
                    try{
                        ListItem folder = fileExplorer.FindSingle <ListItem>(folderXpath, 5000);
                        folder.DoubleClick();
                        Delay.Milliseconds(500);
                    }
                    catch (ElementNotFoundException ex) {
                        // report fail
                        Report.Log(ReportLevel.Failure, "Folder not found: " + path);
                        throw ex;
                    }
                    fileExplorerXpath = "/form[@processname='explorer' and @title='" + dir[i] + "']";
                }
            }
            // report success
            Report.Log(ReportLevel.Success, "Install the DHS content to: " + path);
            // close file explorer
            repo.Explorer.Close.Click();
        }
        public static void Function2()
        {
            Ranorex.Button buttonLoad_template = null;
            buttonLoad_template = "/dom[@domain~'^.*']/body/flexobject/form/element[@type='ControlBar']/button[@text='Load template...']";
            buttonLoad_template.Click();
            Ranorex.Form formChoose_Template = null;
            formChoose_Template = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']";
            formChoose_Template.Click();
            Ranorex.Button buttonButton  = null;
            Ranorex.Button buttonButton2 = "/dom[@domain='10.200.20.36:8888']/body/flexobject/form[@title='Choose Template']/form/container/combobox/button[@type='Button']";
            buttonButton = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']/form/container/combobox/button[@type='Button']";
            buttonButton2.Click();
            buttonButton2.Click();
            //formChoose_Template.Click();

            //Ranorex.Form formChoose_Template1 = "/dom[@domain='10.200.20.65:8282']/body/flexobject/form[@title='Choose Template']";
            List listList = null;

            //formChoose_Template1.Click();
            listList = "/dom[@domain~'^.*']/body/flexobject/list[@type='List']";
            int count = listList.Items.Count;
            int i     = 1;

            Ranorex.Button buttonLoad = null;
            buttonLoad = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']/element[@type='ControlBar']/button[@text='Load']";
            foreach (Ranorex.ListItem item in listList.Items)
            {
                Keyboard.Press(Keys.Down, 80, Keyboard.DefaultKeyPressTime, 1, false);
                Report.Info(item.Text);
                i = i + 1;
                if (param == item.Text)
                {
                    if (i < count)
                    {
                        Keyboard.Press(Keys.Up, 80, Keyboard.DefaultKeyPressTime, 1, false);
                    }
                    buttonLoad.Click();

                    break;
                }
                else
                {
                    Report.Info(item.Text + " doesnt matched with " + param);
                }
            }
        }
        public static void Function2()
        {
            Ranorex.Button buttonLoad_template = null;
            buttonLoad_template = "/dom[@domain~'^.*']/body/flexobject/form/element[@type='ControlBar']/button[@text='Load template...']";
            buttonLoad_template.Click();
            Ranorex.Form formChoose_Template = null;
            formChoose_Template = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']";
            formChoose_Template.Click();
            Ranorex.Button buttonButton = null;
            buttonButton = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']/form/container/combobox/button[@type='Button']";
            buttonButton.Click();
            Ranorex.Button buttonButton1 = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']/form/container/combobox/button[@type='Button']";
            buttonButton1.Click();
            buttonButton1.Click();
            List listList = null;

            listList = "/dom[@domain~'^.*']/body/flexobject/list[@type='List']";
            int count = listList.Items.Count;
            // messagebox.Show(count)
            int i = 1;

            Ranorex.Button buttonLoad = null;
            buttonLoad = "/dom[@domain~'^.*']/body/flexobject/form[@title='Choose Template']/element[@type='ControlBar']/button[@text='Load']";
            foreach (Ranorex.ListItem item in listList.Items)
            {
                Keyboard.Press(Keys.Down, 80, Keyboard.DefaultKeyPressTime, 1, false);
                Report.Info(item.Text);
                i = i + 1;
                if (process_name == item.Text)
                {
//					if (i < count) {
//						Keyboard.Press(Keys.Up, 80, Keyboard.DefaultKeyPressTime, 1, false);
//					}
                    //	MessageBox.Show(item.Text);
                    buttonLoad.Click();

                    break;
                }
                else
                {
                    Report.Info(item.Text + " doesnt matched with " + process_name);
                }
            }
        }
        public void WaitForPopup(string axPath)
        {
            int  retries = 0;
            bool found   = false;

            while ((!found) && (retries < 10))
            {
                try
                {
                    Form Popup = axPath;
                    found = true;
                }
                catch
                {
                    retries++;
                    if (retries == 10)
                    {
                        throw new Exception("Popup '" + axPath + "' not found yet");
                    }
                }
            }
        }
예제 #6
0
 public static void EnsureMainWindowVisible()
 {
     Ranorex.Form frmMainWindow = Host.Local.FindSingle <Ranorex.Form>("/form[@title='SystemX']", 5000);
     frmMainWindow.Activate();
 }
예제 #7
0
        public static string RestartSystemX(bool autoLogin = true)
        {
            string response = "Det oppsto kritisk feil på den foregående test. Starte System X program";

            try
            {
                // Kill System X process
                Process systemxProcess = Process.GetProcessesByName("Systemx")[0];
                systemxProcess.Kill();
                Delay.Seconds(2);
                KillCrashProgram();
                try
                {
                    // Get the System X path and run it
                    string appName = File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\SystemxPath.log");
                    Process.Start(appName);

                    // If System X is not properly terminated, this window will popup
                    try
                    {
                        Ranorex.Form frmProgFail = Host.Local.FindSingle <Ranorex.Form>("/form[@title='Bekreft']", 5000);
                        frmProgFail.PressKeys("{ESCAPE}");
                    }
                    catch (ElementNotFoundException)
                    {
                        // Do nothing
                    }

                    if (autoLogin)
                    {
                        try
                        {
                            // Get login details
                            string[] details  = File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + @"\login.log").Split(';');
                            string   username = details[0];
                            string   password = details[1];
                            try
                            {
                                Ranorex.Text txtUsername = Host.Local.FindSingle <Ranorex.Text>("/form[@controlname='FPassord']/text[@controlname='UsrName']", 2000);
                                Ranorex.Text txtPassword = Host.Local.FindSingle <Ranorex.Text>("/form[@controlname='FPassord']/text[@controlname='PWord']", 2000);
                                txtUsername.Focus();
                                txtUsername.PressKeys(username);
                                txtPassword.Focus();
                                txtPassword.PressKeys(password);
                                Ranorex.Form frmCalendar = Host.Local.FindSingle <Ranorex.Form>("/form[@controlname='fdt']", 3000);
                                frmCalendar.Activate();
                                frmCalendar.PressKeys("{ENTER}");
                                Delay.Seconds(2);
                            }
                            catch (ElementNotFoundException)
                            {
                                //Do nothing
                            }
                        }
                        catch (FileNotFoundException)
                        {
                            response = "Kan ikke logge inn automatisk. Finner ikke loggfilen som inneholder de siste innloggingsdetaljer";
                        }
                    }
                }
                catch (FileNotFoundException)
                {
                    response = "Kan ikke starte System X. Loggfilen som inneholder mangler System X stien";
                }
            }
            catch (IndexOutOfRangeException)
            {
                response = "Kan ikke avslutte System X prosess. Kan ikke finne prosessnavnet";
            }
            return(response);
        }
예제 #8
0
        public void CheckDigitalSignature()
        {
            string path     = @"C:\Program Files\Dell\Dell Help & Support";
            string fileName = @"Microsoft.Win32.TaskScheduler.dll";

            // press Window E open file explorer
            Ranorex.Keyboard.Press("{LWin down}e{LWin up}");
            Delay.Milliseconds(1000);

            System.Diagnostics.Debug.WriteLine(path);
            // split path into item
            string[]     dir               = path.Split('\\');
            Ranorex.Form fileExplorer      = null;
            string       fileExplorerXpath = null;

            for (int i = 0; i < dir.Count(); i++)
            {
                System.Diagnostics.Debug.WriteLine(dir[i]);
                if (i == 0)
                {
                    repo.Explorer.ToolBar1001.Click();
                    Ranorex.Keyboard.Press(dir[i]);
                    Ranorex.Keyboard.Press("{Return}");
                    fileExplorerXpath = "/form[@processname='explorer' and @title='" + "OS (" + dir[i] + ")']";
                }
                else
                {
                    // find file explorer
                    fileExplorer = null;
                    Ranorex.Core.Element element = Host.Local.FindSingle(fileExplorerXpath, 5000);
                    if (element != null)
                    {
                        fileExplorer = element;
                    }
                    // check if folder exist
                    string folderXpath = "element[@class='ShellTabWindowClass']//element[@instance='1']/container[@caption='ShellView']/list/listitem[@text='" + dir[i] + "']";
                    try{
                        ListItem folder = fileExplorer.FindSingle <ListItem>(folderXpath, 5000);
                        folder.DoubleClick();
                        Delay.Milliseconds(500);
                    }
                    catch (ElementNotFoundException ex) {
                        // report fail
                        Report.Log(ReportLevel.Failure, "Folder not found: " + path);
                        throw ex;
                    }
                    fileExplorerXpath = "/form[@processname='explorer' and @title='" + dir[i] + "']";
                }
            }

            // select file Microsoft.Win32.TaskScheduler.dll, open property
            Ranorex.Keyboard.Press("Microsoft");
            // check if folder exist
            string   fileXpath = "element[@class='ShellTabWindowClass']//element[@instance='1']/container[@caption='ShellView']/list/listitem[@text='" + fileName + "']";
            ListItem file      = fileExplorer.FindSingle <ListItem>(fileXpath, 5000);

            file.Click();
            Delay.Milliseconds(200);
            // open property
            Ranorex.Keyboard.Press("{RMenu down}{Return}{RMenu up}");
            Delay.Milliseconds(200);

            repo.MicrosoftWin32TaskSchedulerDllProper.DigitalSignatures.Click();
            Delay.Milliseconds(200);

            Cell nameOfSigner = repo.MicrosoftWin32TaskSchedulerDllProper.Self.FindSingle <Cell>(@"container[@caption='Digital Signatures']//cell[@text='Name of signer:']/following-sibling::cell[][1]");

            nameOfSigner.Click();

            string expectedNameOfSigner = "Dell Inc";
            string actualNameOfSigner   = nameOfSigner.Text;

            Report.Info("Launch SHD install location and check Digital Signaltures:");
            Report.Log((actualNameOfSigner == expectedNameOfSigner)?ReportLevel.Success:ReportLevel.Failure, "Check name of Signer actual= " + actualNameOfSigner + ", expected = " + expectedNameOfSigner);

            repo.MicrosoftWin32TaskSchedulerDllProper.Close.Click();
            Delay.Milliseconds(1000);

            // close file explorer
            repo.Explorer.Close.Click();
        }
예제 #9
0
        public void checkFolderExits(string path, string action)
        {
            // press Window E open file explorer
            Ranorex.Keyboard.Press("{LWin down}e{LWin up}");
            Delay.Milliseconds(1000);

            System.Diagnostics.Debug.WriteLine(path);
            // split path into item
            string[] dir = path.Split('\\');
            string   fileExplorerXpath = null;

            bool found = true;

            for (int i = 0; i < dir.Length; i++)
            {
                System.Diagnostics.Debug.WriteLine(dir[i]);
                if (i == 0)
                {
                    repo.Explorer.ToolBar1001.Click();
                    Ranorex.Keyboard.Press(dir[i]);
                    Ranorex.Keyboard.Press("{Return}");
                    fileExplorerXpath = "/form[@processname='explorer' and @title='" + "OS (" + dir[i] + ")']";
                }
                else
                {
                    // find file explorer
                    Ranorex.Form         fileExplorer = null;
                    Ranorex.Core.Element element      = Host.Local.FindSingle(fileExplorerXpath, 5000);
                    if (element != null)
                    {
                        fileExplorer = element;
                    }
                    // check if folder exist
                    string folderXpath = "element[@class='ShellTabWindowClass']//element[@instance='1']/container[@caption='ShellView']/list/listitem[@text='" + dir[i] + "']";

                    try{
                        ListItem folder = fileExplorer.FindSingle <ListItem>(folderXpath, 5000);

                        if (i < dir.Length - 1)
                        {
                            folder.DoubleClick();
                            Delay.Milliseconds(500);
                        }
                    }
                    catch (ElementNotFoundException) {
                        // report fail
//						Report.Log(ReportLevel.Failure, "Folder not found: " + path);
                        found = false;
                        break;
                        // throw ex;
                    }

                    fileExplorerXpath = "/form[@processname='explorer' and @title='" + dir[i] + "']";
                }
            }

            // report
            if (action.Equals("No"))
            {
                Report.Log((found == false)?ReportLevel.Success:ReportLevel.Failure, "Check Folder not Exist: " + path);
            }
            else
            {
                Report.Log((found == true)?ReportLevel.Success:ReportLevel.Failure, "Check Folder Exist: " + path);
            }

            // close file explorer
            repo.Explorer.Close.Click();
        }