示例#1
0
        public static void GetWebDriver(string browser)
        {
            if (browser == "chrome")
            {
                IoLibrary.WriteLine("Launching Chrome Browser.");
                ChromeOptions options = new ChromeOptions();
                options.AddArguments("--start-maximized");
                options.AddArguments("--disable-extensions");
                Driver = new ChromeDriver(IoLibrary.GetBinPath(), options);
                Driver.Manage().Cookies.DeleteAllCookies();
            }
            else if (browser == "firefox")
            {
                // todo: add proper ff loation code..  System.setProperty("webdriver.gecko.driver", "src/main/resources/geckodriver");
            }
            else if (browser == "seleniumGrid")
            {
                IoLibrary.WriteLine("Launching Browser Using Selenium Grid - Chrome Browser.");

                const string  gridUrl = "http://*****:*****@SESYNPZ6.gridlastic.com:80/wd/hub";
                ChromeOptions options = new ChromeOptions();
                options.AddArguments("--start-maximized");
                options.AddArguments("--disable-extensions");
                DesiredCapabilities capabilities = DesiredCapabilities.Chrome();
                capabilities.SetCapability(ChromeOptions.Capability, options);
                Driver = new RemoteWebDriver(capabilities);
            }
            else
            {
                throw new Exception(string.Format("Browser Type {0}, not Found, please add additional code for this desired WebDriver Type.", browser));
            }
        }
示例#2
0
 public static bool CompareResultContains(String actual, String expected)
 {
     if (actual.Contains(expected))
     {
         IoLibrary.WriteLine(String.Format("PASS: Actual({0}) | ExpectedToContain({1})", actual, expected));
         return(true);
     }
     else
     {
         IoLibrary.WriteLine(String.Format("FAIL: Actual({0}) | ExpectedToContain({1})", actual, expected));
         return(false);
     }
 }
 public static bool CompareResult(bool actual, bool expected)
 {
     if (actual == expected)
     {
         IoLibrary.WriteLine(String.Format("PASS: Actual({0}) | Expected({1})", actual, expected));
         return(true);
     }
     else
     {
         IoLibrary.WriteLine(String.Format("FAIL: Actual({0}) | Expected({1})", actual, expected));
         return(false);
     }
 }