public void MailManipulation() { MailPageObjects mailPage = new MailPageObjects(driver); if (TestConfig.Browser == "IE") { mailPage.postChapter.Click(); } Assert.IsTrue(mailPage.mailadress.Displayed); WaitExtensions.WaitForElement(driver, mailPage.drafts); Assert.IsTrue(mailPage.mail.Text.Contains("Невелика довідка про")); Actions action = new Actions(driver); action.MoveToElement(mailPage.mail).Build().Perform(); Thread.Sleep(7000); Assert.IsTrue(mailPage.checkpopup.Text.Contains("Пропонуємо Вам ознайомитися")); mailPage.ChoosePopup("Невелика довідка про"); mailPage.acceptbutton.Click(); IAlert alert = driver.SwitchTo().Alert(); alert.Dismiss(); mailPage.CheckMail(); }
public void NewWindow() { IWebElement secondTab = driver.FindElement(By.XPath("//a[@class='ho_logo']")); secondTab.SendKeys(Keys.Control + Keys.Return); var Windows = driver.WindowHandles; driver.SwitchTo().Window(Windows[1]); WaitExtensions.PageLoadWait(driver); driver.FindElement(By.XPath("/html/body/div[2]/div[3]/ul[1]/li[8]/a")).Click(); string SecondWindow = driver.CurrentWindowHandle; driver.SwitchTo().Window(Windows[0]); WaitExtensions.PageLoadWait(driver); driver.Navigate().Refresh(); IWebElement checklogout = driver.FindElement( By.CssSelector("body > div.body_container > div:nth-child(6) > div.Right > dl > dd:nth-child(10) > a")); Assert.IsTrue(checklogout.Displayed); }
public void A_CreateLetter() { MailPageObjects mailPageObject = new MailPageObjects(driver); if (TestConfig.Browser == "IE") { mailPageObject.postChapter.Click(); } mailPageObject.createLetterButton.Click(); mailPageObject.fieldMail.SendKeys(TestConfig.Mail); mailPageObject.fieldTheme.SendKeys(TestConfig.Theme); mailPageObject.fieldText.SendKeys("Some very usefull information"); mailPageObject.insert.Click(); WaitExtensions.PageLoadWait(driver); //Was thread sleep // mailPageObject.insertButton.Click(); Thread.Sleep(5000); string file = "Program.cs"; string filePath = @"E:\Clone\File\" + file; //задаємо шлях до файлу driver.FindElement(By.XPath("//input[@type='file']")).SendKeys(filePath); Thread.Sleep(5000); //вставляємо його в інпут // WaitExtensions.PageLoadWait(driver); //Was thread sleep mailPageObject.saveLetter.Click(); }
public void A_CreateLetter() { MailPageObjects mailPageObject = new MailPageObjects(driver); if (TestConfig.Browser == "IE") { mailPageObject.postChapter.Click(); } mailPageObject.createLetterButton.Click(); WaitExtensions.PageLoadWait(driver); mailPageObject.fieldMail.SendKeys(TestConfig.Mail); mailPageObject.fieldTheme.SendKeys(TestConfig.Theme); mailPageObject.fieldText.SendKeys("Some very usefull information"); mailPageObject.insert.Click(); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); wait.Until(p => mailPageObject.uploadArea.Enabled); string file = "Program.cs"; string filePath = @"E:\Mail Manipulation\File\" + file; driver.FindElement(By.XPath("//input[@type='file']")).SendKeys(filePath); mailPageObject.saveLetter.Click(); }
public void B_CheckLetter() { MailPageObjects mailPageObject = new MailPageObjects(driver); WaitExtensions.WaitForElement(driver, mailPageObject.drafts); mailPageObject.drafts.Click(); mailPageObject.CheckMail(TestConfig.Mail, TestConfig.Theme); mailPageObject.CheckMailText(TestConfig.Theme); ChromeOptions chromeOptions = new ChromeOptions(); string File = "Program.cs"; string FilePath = @"E:\Clone\Save Result\" + File; driver.FindElement(By.LinkText("Program.cs")).Click(); }
public void TranslateText(string firstlang, string seclang, string word, string translatedWord) { WaitExtensions.PageLoadWait(driver); WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30)); TranslatorObject translateObject = new TranslatorObject(driver); Actions action = new Actions(driver); translateObject.selectFirstlang.Click(); wait.Until(p => translateObject.firstLangPopup.Enabled); translateObject.SelectFirstLan(firstlang); translateObject.selectSeclang.Click(); wait.Until(p => translateObject.secondLangPopup.Enabled); translateObject.SecondLan(seclang); translateObject.SendWord(word); translateObject.TranslateButton.Click(); translateObject.GetWord(translatedWord); }
public void E_TextFormatterManipulation() { TextForamtterObjects textFormatObject = new TextForamtterObjects(driver); IWebElement textformat; WaitExtensions.PageLoadWait(driver); if (TestConfig.Browser == "IE") { textFormatObject.textformatIE.Clear(); WaitExtensions.PageLoadWait(driver); textFormatObject.textformatIE.SendKeys("some text "); WaitExtensions.PageLoadWait(driver); textFormatObject.submitButton.Click(); IAlert alert = driver.SwitchTo().Alert(); alert.Accept(); textFormatObject.textformatIE.Clear(); } else { driver.SwitchTo().Frame("noiseWidgIframe"); textFormatObject.textformat.Click(); WaitExtensions.PageLoadWait(driver);; textFormatObject.textformat.Clear(); WaitExtensions.PageLoadWait(driver); textFormatObject.textformat.SendKeys("some text "); WaitExtensions.PageLoadWait(driver); Assert.IsTrue(textFormatObject.textformat.Text.Contains("some text")); driver.SwitchTo().DefaultContent(); textFormatObject.submitButton.Click(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(2); IAlert alert = driver.SwitchTo().Alert(); alert.Accept(); driver.SwitchTo().Frame("noiseWidgIframe"); textFormatObject.textformat.Clear(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(2); } }
/// <summary> /// Goes to custom page. /// </summary> /// <param name="pageToNavigate">The page to navigate.</param> public void GoToPagePos(string pageToNavigate) { Driver.Navigate().GoToUrl(BaseUrl + pageToNavigate); WaitExtensions.Wait(() => Driver.WaitForPageLoaded(), TimeSpan.FromSeconds(3), "URL isn't reached"); }
/// <summary> /// Goes to custom page. /// </summary> /// <param name="pageToNavigate">The page to navigate.</param> public void GoToPage(string pageToNavigate) { Driver.Navigate().GoToUrl(BaseUrl + pageToNavigate); WaitExtensions.Wait(() => Driver.Url.Contains(BaseUrl + pageToNavigate), TimeSpan.FromSeconds(3), "URL isn't reached"); }