Esempio n. 1
0
        public void CreateWebDriver()
        {
            driverSetUp = new DriverSetUp();
            driverSetUp.SetUpDrivers();

            ChromeOptions chromeOpt = new ChromeOptions();
            //opchromeOpttions.AddArguments("--whitelisted-ips=''");
            string downloadFolder = paths.solutionRuntimeFilesPath;

            chromeOpt.AddUserProfilePreference("download.default_directory", downloadFolder); // Set another directory when downloading a file;
            //chromeOpt.AddUserProfilePreference("download.prompt_for_download", true); // Ask directory when downloading a file;

            // The environment variable it's created through the Jenkinsfile
            env = new EnvironmentHelper();
            string executingCI = env.GetEnvVariableValue("CI_EXECUTION");

            if (executingCI == "" || executingCI == null)
            {
                Driver = new ChromeDriver(driverSetUp.ChromeDriverFolder, chromeOpt);
            }
            else
            {
                Driver = new RemoteWebDriver(new Uri("http://localhost:4444/wd/hub"), chromeOpt.ToCapabilities(), TimeSpan.FromSeconds(120));
            }

            window = new WindowManagerHelper(Driver);
            window.SetWindowMaximized();
        }
Esempio n. 2
0
        public MobileBrowserTests()
        {
            ChromeMobileEmulationDeviceSettings deviceSettings = new ChromeMobileEmulationDeviceSettings();

            deviceSettings.Width     = 1024;
            deviceSettings.Height    = 1366;
            deviceSettings.UserAgent = "CustomDevice";

            ChromeOptions chromeOpt = new ChromeOptions();

            chromeOpt.EnableMobileEmulation(deviceSettings);

            setup   = new DriverSetUp();
            driver  = new ChromeDriver(setup.ChromeDriverFolder, chromeOpt);
            element = new ElementHelper(driver);
        }