示例#1
0
        public void SelectAllowedMaterialTypes()
        {
            IList <IWebElement> AllowedMaterialsDropDown = new List <IWebElement>(Driver.Instance.FindElements(By.CssSelector("form[sf-schema = 'acqSettingsCtrl.schema']")));

            if (AllowedMaterialsDropDown.Count > 0)
            {
                foreach (IWebElement Dropdown in AllowedMaterialsDropDown)
                {
                    ((IJavaScriptExecutor)Driver.Instance).ExecuteScript("arguments[0].scrollIntoView(true);", Dropdown);
                    Driver.HighlightElement(Dropdown);

                    IWebElement AllowedMaterialsSelected = Dropdown.FindElement(AllowedMaterialsSelected_locator);
                    Klick.On(AllowedMaterialsSelected);

                    IWebElement AllowedMaterialArticle = Dropdown.FindElement(AllowedMaterialArticle_locator);
                    if (AllowedMaterialArticle.Selected == false)
                    {
                        Klick.On(AllowedMaterialArticle);
                        statusreturntext = Pages.PearlEditBuffer.StatusMessage();
                        if (statusreturntext != "Priority Type added")
                        {
                            Console.WriteLine("Error while selecting Allowed Material Article." + statusreturntext);
                        }
                        else
                        {
                            Console.WriteLine("Allowed Material Article selecting Successful.");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Allowed Material Article already selected." + statusreturntext);
                    }
                    Thread.Sleep(KortextGlobals.s);

                    IWebElement AllowedMaterialBook = Dropdown.FindElement(AllowedMaterialBook_locator);
                    if (AllowedMaterialBook.Selected == false)
                    {
                        Klick.On(AllowedMaterialBook);
                        statusreturntext = Pages.PearlEditBuffer.StatusMessage();
                        if (statusreturntext != "Priority Type added")
                        {
                            Console.WriteLine("Error while selecting Allowed Material Book." + statusreturntext);
                        }
                        else
                        {
                            Console.WriteLine("Allowed Material Book selecting Successful.");
                        }
                    }
                    else
                    {
                        Console.WriteLine("Allowed Material Book already selected." + statusreturntext);
                    }

                    //IWebElement AllowedMaterialsSelected = Dropdown.FindElement(AllowedMaterialsSelected_locator);
                    Klick.On(AllowedMaterialsSelected);

                    Thread.Sleep(KortextGlobals.s);
                    Console.WriteLine("Allowed Materials Selection Completed.");
                    break;
                }
            }
        }