PiroPiro.Selenium.SeleniumBrowser.SeleniumBrowser C# (CSharp) Method

SeleniumBrowser() public method

public SeleniumBrowser ( RemoteWebDriver driver, bool isLocal, Configuration cfg = null ) : System
driver OpenQA.Selenium.Remote.RemoteWebDriver
isLocal bool
cfg Configuration
return System
        public SeleniumBrowser(RemoteWebDriver driver, bool isLocal, Configuration cfg = null)
            : base(cfg)
        {
            this.driver = driver;
            this.isLocal = isLocal;

            if (ImplicitWaitTimeout.HasValue && ImplicitWaitTimeout.Value.TotalMilliseconds > 0)
            {
                this.driver.Manage().Timeouts().ImplicitlyWait(ImplicitWaitTimeout.Value);
            }

            string windowSize = Configuration.Get<string>("BrowserWindowSize", false);
            if (!string.IsNullOrWhiteSpace(windowSize))
            {
                int width = 0, height = 0;
                if (windowSize.Trim() != "*")
                {
                    var dimensions = windowSize.Split(new[] { 'x' }, StringSplitOptions.RemoveEmptyEntries);
                    int.TryParse(dimensions[0].Trim(), out width);
                    if (dimensions.Length > 1)
                    {
                        int.TryParse(dimensions[1].Trim(), out height);
                    }
                }

                if (width <= 0)
                {
                    width = IsLocal ? (int)System.Windows.SystemParameters.WorkArea.Width : 1024;
                }
                if (height <= 0)
                {
                    height = IsLocal ? (int)System.Windows.SystemParameters.WorkArea.Height : 768;
                }

                this.driver.Manage().Window.Position = new System.Drawing.Point(0, 0);
                this.driver.Manage().Window.Size = new System.Drawing.Size(width, height);
            }
        }