コード例 #1
0
        public override DriverWrapper CreateDriver(string agentString)
        {
            DriverWrapper driver = null;

            var sCaps = new DesiredCapabilities();

            try
            {
                if (string.IsNullOrEmpty(agentString) == false)
                {
                    var options = new PhantomJSOptions();
                    options.AddAdditionalCapability("phantomjs.page.settings.userAgent", agentString);

                    driver = new DriverWrapper(new PhantomJSDriver(options));
                }
                else
                {
                    driver = new DriverWrapper(new ChromeDriver());
                }
            }
            catch (Exception e)
            {
                log2.Error("Exception: " + e);
            }

            return(driver);
        }
コード例 #2
0
        public override DriverWrapper CreateDriver(string agentString)
        {
            DriverWrapper driver = null;

            try
            {
                if (string.IsNullOrEmpty(agentString) == false)
                {
                    ChromeOptions options = new ChromeOptions();
                    options.AddArgument(agentString);
                    driver = new DriverWrapper(new ChromeDriver(options));
                }
                else
                {
                    driver = new DriverWrapper(new ChromeDriver());
                }
            }
            catch (Exception e)
            {
                log.Error("Exception: " + e);
            }

            return(driver);
        }