Created
August 24, 2018 14:09
-
-
Save nikolay-advolodkin/8cf92ad7b1849d32b844c9f4515a048a to your computer and use it in GitHub Desktop.
Sample test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Threading; | |
using NUnit.Framework; | |
using OpenQA.Selenium; | |
using OpenQA.Selenium.Chrome; | |
using OpenQA.Selenium.IE; | |
namespace ClientDebuggingTests | |
{ | |
[TestFixture] | |
public class MGA | |
{ | |
IWebDriver Driver; | |
[Test] | |
[Parallelizable] | |
public void ChromeTest() | |
{ | |
Driver = new ChromeDriver(); | |
RunTest(); | |
} | |
[Test] | |
[Parallelizable] | |
public void IETest() | |
{ | |
var caps = new InternetExplorerOptions(); | |
caps.EnableNativeEvents = false; | |
caps.IgnoreZoomLevel = true; | |
caps.EnablePersistentHover = true; | |
caps.IntroduceInstabilityByIgnoringProtectedModeSettings = true; | |
Driver = new InternetExplorerDriver(@"C:\Users\Nikolay Advolodkin\Downloads\IEDriverServer_x64_3.14.0", caps); | |
RunTest(); | |
} | |
private void RunTest() | |
{ | |
Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(20); | |
Driver.Navigate().GoToUrl("https://portal.gainscoconnect.com/"); | |
var agency = Driver.FindElement(By.XPath("//*[@id='ctl00_ctl00_body_contentRight_txtAgency']")); | |
agency.Clear(); | |
agency.SendKeys(Keys.Control + "a"); | |
agency.SendKeys(Keys.Delete); | |
agency.SendKeys("99988"); | |
Driver.FindElement(By.Id("ctl00_ctl00_body_contentRight_txtUserName")).SendKeys("HIDDEN"); | |
Driver.FindElement(By.Id("ctl00_ctl00_body_contentRight_txtPassword")).SendKeys("REPLACE ME"); | |
Driver.FindElement(By.Id("ctl00_ctl00_body_contentRight_btnLogin")).Click(); | |
Thread.Sleep(3000); | |
Driver.FindElement(By.Id("ctl00_ctl00__navMenu-menuItem002")).Click(); | |
Thread.Sleep(3000); | |
Driver.FindElement(By.Id("ctl00_ctl00_body_body__btnAddDriver")).Click(); | |
} | |
[TearDown] | |
public void TearDownForTest() | |
{ | |
Driver.Quit(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment