Пример #1
0
        /// <summary>
        /// Method to start the application with the specified type of browser, platform and URL
        /// </summary>
        public static void Start(BrowserType browserType, PlatformType platformType, string serverUrl, string driverPath, string applicationURL)
        {
            string browser = browserType.ToString().ToLower();
            DesiredCapabilities compat;

            switch (browserType)
            {
            case BrowserType.InternetExplorer:
                compat = DesiredCapabilities.InternetExplorer();
                break;

            case BrowserType.Chrome:
                compat = DesiredCapabilities.Chrome();
                break;

            case BrowserType.Safari:
                compat = DesiredCapabilities.Safari();
                break;

            case BrowserType.Firefox:
            default:
                compat = DesiredCapabilities.Firefox();
                break;
            }

            compat.IsJavaScriptEnabled = true;
            compat.Platform            = new Platform(platformType);
            webDriver = new ScreenShotRemoteWebDriver(compat);
            webDriver.Manage().Window.Maximize();
            webDriver.Url = applicationURL;
        }
Пример #2
0
        public static T ExecuteJavaScriptAndGetValue <T>(this ScreenShotRemoteWebDriver driver, string script)
        {
            object v = driver.ExecuteScript(string.Format("return {0}", script));

            return((T)v);
        }
Пример #3
0
 public static void ExecuteJavaScript(this ScreenShotRemoteWebDriver driver, string script)
 {
     driver.ExecuteScript(script);
 }
Пример #4
0
 private void getRemoteScreenshot(ScreenShotRemoteWebDriver theWebDriver,
     String browser, String version, String stringURL)
 {
     Screenshot screenshot = theWebDriver.GetScreenshot();
     screenshot.SaveAsFile(screenshotPath + browser + "_" + version + "_" + stringURL + ".jpeg", ImageFormat.Jpeg);
 }