Пример #1
0
 private void SelectAddToMyTrialsList()
 {
     PageHelper.WaitForElement(Driver, Comment);
     Comment.Click();
     PageHelper.WaitForElement(Driver, AddToMySiteListSectionYes);
     AddToMySiteListSectionYes.Click();
 }
        internal void FormSubmitwithDDT()
        {
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));

            try
            {
                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(FileUpload));
                string wanted_path = Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, "..\\..\\..\\GlobalSQA\\"));
                Helpers.ExcelLib.populateInCollection(wanted_path + "TestData.xlsx", "Data");
                FileUpload.SendKeys(wanted_path + "NUNNA.jpg");
                Name.Click();
                Name.SendKeys(Helpers.ExcelLib.ReadData(2, "Name"));
                Email.SendKeys(Helpers.ExcelLib.ReadData(2, "Email"));
                Website.SendKeys(Helpers.ExcelLib.ReadData(2, "WebSite"));
                SelectElement expe = new SelectElement(Experience);
                expe.SelectByValue(Helpers.ExcelLib.ReadData(2, "Experiene"));
                Functional.Click();
                Automation.Click();
                Manual.Click();
                Education.Click();
                AlertButton.Click();
                IAlert alert = driver.SwitchTo().Alert();
                alert.Accept();
                IAlert alert1 = driver.SwitchTo().Alert();
                alert1.Accept();
                Helpers.HelperClass.GetElementAndScrollTo(driver, By.XPath("//textarea[@class='textarea']"));
                Comment.Click();
                Comment.SendKeys(Helpers.ExcelLib.ReadData(2, "Comment"));
                string FilledForm = Helpers.HelperClass.SaveScreenshot(driver, "FilledForm");
                Test.Log(Status.Pass, "Before form Submitted", MediaEntityBuilder.CreateScreenCaptureFromPath(FilledForm).Build());
                Submit.Click();
                wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.ElementToBeClickable(ResponseMesage));
                Helpers.HelperClass.GetElementAndScrollTo(driver, By.XPath("//div[@class='twelve columns']//h3"));
                String responseMsg = ResponseMesage.Text;
                Assert.AreEqual(responseMsg, Helpers.ExcelLib.ReadData(2, "Assertion"));
                string ResponseMsgScreenShot = Helpers.HelperClass.SaveScreenshot(driver, "ResponseMsgScreenShot");
                Test.Log(Status.Pass, "After Response Generated", MediaEntityBuilder.CreateScreenCaptureFromPath(ResponseMsgScreenShot).Build());
            }
            catch (Exception e)
            {
                Test.Log(AventStack.ExtentReports.Status.Fail, "Test failed,please check the logs" + e);
            }
        }