Esempio n. 1
0
        public bool SetComboItem(IWebDriver FF_driver, string ID, string InputValue)
        {
            bool bResult = true;

#if (DEBUG)
            g_Util.DebugPrint("[SetComboItem]" + ID + ", " + InputValue);
#endif
            if (TotalWait(FF_driver, ID) == false)
            {
                g_Util.DebugPrint("Element Waiting False. Skip this action.  " + ID);
                bResult = true;
            }
            else
            {
                IWebElement SelectedElement = FindElemnt(FF_driver, ID);
                if (SelectedElement == null)
                {
                    g_Util.DebugPrint("[Error] SetComboItem Element Find Fail ");
                    bResult = false;
                }
                else
                {
                    bool bFind = false;
                    foreach (var Elem in SelectedElement.FindElements(By.TagName("li")))
                    {
                        if (Elem.Text == InputValue)
                        {
                            Elem.Click();
                            g_Util.DebugPrint("Select: " + InputValue);

                            bFind   = true;
                            bResult = true;
                        }
                    }

                    if (bFind == false)
                    {
                        g_Util.DebugPrint("[Warning] No Item in List. Input Value = " + InputValue);
                        bResult = false;
                    }
                    else
                    {
                        bResult = true;
                    }
                }
            }

            return(bResult);
        }