public ChromeDriver Build(bool killAnotherChromeDriverProcesses = true)
        {
            if (!Options.Arguments.Contains("headless"))
            {
                Options.AddArgument("start-maximized");
            }

            if (killAnotherChromeDriverProcesses)
            {
                Process.GetProcessesByName("chromedriver.exe").ToList().ForEach(x => x.Kill());
            }

            return(new ChromeDriver(Service, Options, TimeSpan.FromSeconds(180)));
        }
        public ChromeDriverBuilder WithLanguage(ChromeDriverLanguage language)
        {
            switch (language)
            {
            case ChromeDriverLanguage.English:
                Options.AddArgument("--lang=en");
                break;

            case ChromeDriverLanguage.Portuguese:
                Options.AddArgument("--lang=pt");
                break;
            }

            return(this);
        }
Пример #3
0
        public Bank(bool isPrivate, string personalNumber, bool headless = false, bool mobile = false)
        {
            IsPrivate = isPrivate;
            IsMobile  = mobile;
            //string startUrl = "https://secure.handelsbanken.se/logon/se/" + (_isPrivate ? "priv" : "corp") + "/sv/mbidqr/";
            Options.AddArgument("--ignore-certificate-errors");
            Options.AddArguments("--no-sandbox");
            Options.AddArguments("--disable-dev-shm-usage");
            if (headless)
            {
                Options.AddArgument("--headless");
            }
            if (mobile)
            {
                Options.AddArgument("--user-agent=Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25");
            }
            PersonalNumber = personalNumber;

            ChromeDriver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/Chrome", Options);
            SetLoginPageUrl();
            SetLandingPageAfterLoginUrl();
            SetPaymentUrl();
        }