public void CreateQuestion() { //if(prop.getProperty("AssessmentTest").trim().Equals("false")) //throw new SkipException("create Assessment skipped"); try { IJavaScriptExecutor js = (IJavaScriptExecutor)driver; AssessmentQuestions questions = new AssessmentQuestions(driver); //TimeUnit.SECONDS.sleep(3); questions.NewQuestion().Click(); AddQuestion addQuestion = new AddQuestion(driver); //TimeUnit.SECONDS.sleep(5); // Data load will get time addQuestion.ModuleName(prop.getProperty("moduleName")); //TimeUnit.SECONDS.sleep(2); addQuestion.AddQuestionText(prop.getProperty("addQuestionText")); js.ExecuteScript("document.getElementById('txtOption-1').scrollIntoView();"); addQuestion.Option1Data().SendKeys(prop.getProperty("option1Data")); js.ExecuteScript("document.getElementById('txtOption-2').scrollIntoView();"); addQuestion.Option2Data().SendKeys(prop.getProperty("option2Data")); js.ExecuteScript("document.getElementById('txtOption-3').scrollIntoView();"); addQuestion.Option3Data().SendKeys(prop.getProperty("option3Data")); js.ExecuteScript("document.getElementById('txtOption-4').scrollIntoView();"); addQuestion.Option4Data().SendKeys(prop.getProperty("option4Data")); if (prop.getProperty("option1RDButton").Equals("1")) { addQuestion.Option1RDButton().Click(); } if (prop.getProperty("option2RDButton").Equals("1")) { addQuestion.Option2RDButton().Click(); } if (prop.getProperty("option3RDButton").Equals("1")) { addQuestion.Option3RDButton().Click(); } if (prop.getProperty("option4RDButton").Equals("1")) { addQuestion.Option4RDButton().Click(); } addQuestion.Weightage().SendKeys(prop.getProperty("weightage")); addQuestion.SaveQuestion().Click(); //logger.debug("Question is created.."); // Next to publish questions.NextToPublish().Click(); } catch (Exception e) { //logger.error(e.getMessage()); screenShotObj.GetScreenshot(driver, "AddQuestion"); } }
//[Test] public void createQuestion() { if (prop.getProperty("quizTest").Trim().Equals("false")) { //throw new SkipException("Create Quiz skipped"); try { IJavaScriptExecutor js = (IJavaScriptExecutor)driver; AssessmentQuestions questions = new AssessmentQuestions(driver); _test = _extent.StartTest("AddQuestion"); // TimeUnit.SECONDS.sleep(3); questions.NewQuestion().Click(); AddQuestion addQuestion = new AddQuestion(driver); // TimeUnit.SECONDS.sleep(3); // addQuestion.moduleName("1_introduction"); //TimeUnit.SECONDS.sleep(1); addQuestion.AddQuestionText(prop.getProperty("addQuestionText")); js.ExecuteScript("document.getElementById('txtOption-1').scrollIntoView();"); addQuestion.Option1Data().SendKeys(prop.getProperty("option1Data")); js.ExecuteScript("document.getElementById('txtOption-2').scrollIntoView();"); addQuestion.Option2Data().SendKeys(prop.getProperty("option2Data")); js.ExecuteScript("document.getElementById('txtOption-3').scrollIntoView();"); addQuestion.Option3Data().SendKeys(prop.getProperty("option3Data")); js.ExecuteScript("document.getElementById('txtOption-4').scrollIntoView();"); addQuestion.Option4Data().SendKeys(prop.getProperty("option4Data")); //TimeUnit.SECONDS.sleep(1); if (prop.getProperty("option1RDButton").Equals("1")) { addQuestion.Option1RDButton().Click(); } if (prop.getProperty("option2RDButton").Equals("1")) { addQuestion.Option2RDButton().Click(); } if (prop.getProperty("option3RDButton").Equals("1")) { addQuestion.Option3RDButton().Click(); } if (prop.getProperty("option4RDButton").Equals("1")) { addQuestion.Option4RDButton().Click(); } //TimeUnit.SECONDS.sleep(1); addQuestion.Weightage().SendKeys(prop.getProperty("weightage")); addQuestion.SaveQuestion().Click(); //logger.Debug("Question is created.."); // Next to publish questions.NextToPublish().Click(); _test.Log(LogStatus.Pass, "Assert Pass as condition is true"); _extent.EndTest(_test); } catch (Exception e) { //logger.Error(e.Message); screenShotObj.GetScreenshot(driver, "AddQuestion"); } } }