Exemplo n.º 1
0
        public static IControl GetAnswerFieldOfFlatQuestion(string QuestionPrompt, string AnswerFieldType, string AnswerValue)
        {
            string parentPath = DL_PatientsPage.GetFlatQuestionAnswerCellXpath(QuestionPrompt);

            try
            {
                switch (AnswerFieldType.ToUpper())
                {
                case "TEXTBOX":
                case "TEXT BOX":
                    return(SyncUtilities.FindElement(By.XPath(parentPath + "/descendant::input")));

                case "LISTBOX":
                case "LIST BOX":
                    IControl ListBox = SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::select"));
                    return(new Control(ListBox.WebElement, new SelectElement(ListBox.WebElement)));

                case "RADIOBUTTON":
                case "RADIO BUTTON":
                case "RADIO":
                case "CHECKBOX":
                case "CHECK BOX":
                    return(SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::label[contains(text(), '" + AnswerValue + "')]/preceding-sibling::input")));

                case "TEXTAREA":
                case "TEXT AREA":
                    return(SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::textarea")));

                case "TEXT":
                    return(SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::span")));

                case "LINK":
                    return(SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::a[contains(text(), '" + AnswerValue + "')]")));

                default:
                    return(null);
                }
            }
            catch (Exception e)
            {
                //fail case
                return(null);
            }
        }
Exemplo n.º 2
0
        //To do
        public static IControl GetReasonForChangeField(CRFTableQuestionsData Data, IControl TableRow)
        {
            string parentPath = DL_PatientsPage.GetFlatQuestionAnswerCellXpath(Data.QuestionPrompt);

            try
            {
                if (Data.AnswerFieldType.ToUpper() == "LISTBOX")
                {
                    IWebElement ListBox = TableRow.WebElement.FindElement(By.XPath(".//td[text()='" + Data.QuestionPrompt + "']/parent::tr/descendant::select[2]"));
                    return(new Control(ListBox, new SelectElement(ListBox)));
                }
                else
                {
                    IWebElement ListBox = TableRow.WebElement.FindElement(By.XPath(".//td[text()='" + Data.QuestionPrompt + "']/parent::tr/descendant::select"));
                    return(new Control(ListBox, new SelectElement(ListBox)));
                }
            }
            catch (Exception e)
            {
                //Fail statements
                return(null);
            }
        }
Exemplo n.º 3
0
        public static IControl GetReasonForChangeField(CRFFlatQuestionsData Data)
        {
            string parentPath = DL_PatientsPage.GetFlatQuestionAnswerCellXpath(Data.QuestionPrompt);

            try
            {
                if (Data.AnswerFieldType.ToUpper() == "LISTBOX")
                {
                    IControl ListBox = SyncUtilities.FindElement(By.XPath(parentPath + "/descendant::select[2]"));
                    return(new Control(ListBox.WebElement, new SelectElement(ListBox.WebElement)));
                }
                else
                {
                    IControl ListBox = SyncUtilities.FindElement(By.XPath(parentPath + "/descendant::select"));
                    return(new Control(ListBox.WebElement, new SelectElement(ListBox.WebElement)));
                }
            }
            catch (Exception e)
            {
                //Fail statements
                return(null);
            }
        }
Exemplo n.º 4
0
        public static IControl GetAnswerFieldOfFlatQuestion(CRFFlatQuestionsData QuestionData)
        {
            string parentPath = DL_PatientsPage.GetFlatQuestionAnswerCellXpath(QuestionData.QuestionPrompt.Replace("&#x20", " "));

            try
            {
                switch (QuestionData.AnswerFieldType.ToUpper())
                {
                case "TEXTBOX":
                case "TEXT BOX":
                    return(SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::input")));

                case "LISTBOX":
                case "LIST BOX":
                    if (QuestionData.CurrentAnswerValue == null)
                    {
                        IControl ListBox = SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::select"));
                        return(new Control(ListBox.WebElement, new SelectElement(ListBox.WebElement)));
                    }
                    else
                    {
                        IControl ListBox = SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::select[1]"));
                        return(new Control(ListBox.WebElement, new SelectElement(ListBox.WebElement)));
                    }

                case "RADIOBUTTON":
                case "RADIO BUTTON":
                case "RADIO":
                case "CHECKBOX":
                case "CHECK BOX":
                    if (QuestionData.AnswerValue != null)
                    {
                        return(SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::label[contains(text(), '" + QuestionData.AnswerValue + "')]/preceding-sibling::input")));
                    }
                    else
                    {
                        return(SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::label[contains(text(), '" + QuestionData.NewAnswerValue + "')]/preceding-sibling::input")));
                    }

                case "TEXTAREA":
                case "TEXT AREA":
                    return(SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::textarea")));

                case "TEXT":
                    return(SyncUtilities.FindElement(By.XPath(parentPath + "/descendant::span")));

                case "LINK":
                    if (QuestionData.AnswerValue != null)
                    {
                        return(SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::a[contains(text(), '" + QuestionData.AnswerValue + "')]")));
                    }
                    else
                    {
                        return(SyncUtilities.FindVisibleElement(By.XPath(parentPath + "/descendant::a[contains(text(), '" + QuestionData.NewAnswerValue + "')]")));
                    }

                default:
                    return(null);
                }
            }
            catch (Exception e)
            {
                //fail case
                return(null);
            }
        }