/// <summary> /// sets the answer choice list /// </summary> /// <param name="answerChoice">list of answer choices</param> public void SetAnswerChoiceList(List <string> answerChoice) { AnswerChoiceList = new List <AnswerLineItem>(); AnswerChoiceGrid.Wait(3); AnswerContentWebElementList = AnswerContentRows.WaitForElements(5); if (Driver.WrappedDriver.GetType() == typeof(DummyDriver)) { AnswerContentWebElementList = GetDummyIdentifiers(); } if (ItemType == ItemType.TrueFalse) { answerChoice = new List <string>() { "True", "False" }; } foreach (var webElement in AnswerContentWebElementList) { string answer = webElement.Text.Trim(); if (answerChoice.Contains(answer)) { int index = answerChoice.IndexOf(answer); Report.Write("AnswerLineItem index: '" + index + "'; question: '" + answer); var answerLineItem = new AnswerLineItem(ItemType, index, answer); AnswerChoiceList.Add(answerLineItem); } else { throw new Exception("Expected to find the answer: '" + answer + "', but it does not exist in the answer choices."); } } }
/// <summary> /// sets the answer choice list /// </summary> public void SetAnswerChoiceList() { AnswerChoiceList = new List <DraggableLineItem>(); AnswerChoiceGrid.Wait(3); AnswerChoiceWebElementList = AnswerChoiceRows.WaitForElements(5); if (Driver.WrappedDriver.GetType() == typeof(DummyDriver)) { AnswerChoiceWebElementList = GetDummyIdentifiers(); } foreach (var webElement in AnswerChoiceWebElementList) { string key = webElement.GetAttribute("data-key"); string answer = webElement.Text.Trim(); Report.Write("DraggableLineItem data-key: '" + key + "'; answer: '" + answer); var draggableLineItem = new DraggableLineItem(key, answer); AnswerChoiceList.Add(draggableLineItem); } }
/// <summary> /// sets the answer choice list /// </summary> public void SetAnswerChoiceList() { AnswerChoiceList = new List <AnswerGridColumn>(); AnswerChoiceGrid.Wait(3); AnswerContentWebElementList = AnswerContentColumns.WaitForElements(5); if (Driver.WrappedDriver.GetType() == typeof(DummyDriver)) { AnswerContentWebElementList = GetDummyIdentifiers(); } int index = 0; foreach (var webElement in AnswerContentWebElementList) { Report.Write("AnswerGridColumn index: '" + index); var answerLineItem = new AnswerGridColumn(index); AnswerChoiceList.Add(answerLineItem); index++; } }
/// <summary> /// sets the answer choice list /// </summary> public void SetAnswerChoiceList() { AnswerChoiceList = new List <AnswerLineItem>(); AnswerChoiceGrid.Wait(3); AnswerContentWebElementList = AnswerContentRows.WaitForElements(5); if (Driver.WrappedDriver.GetType() == typeof(DummyDriver)) { AnswerContentWebElementList = GetDummyIdentifiers(); } int index = 0; foreach (var webElement in AnswerContentWebElementList) { string answer = webElement.Text.Trim(); Report.Write("AnswerLineItem index: '" + index + "'; question: '" + answer); var answerLineItem = new AnswerLineItem(ItemType, index, answer); AnswerChoiceList.Add(answerLineItem); index++; } }