Exemplo n.º 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;
        }
Exemplo n.º 2
0
        public static T ExecuteJavaScriptAndGetValue <T>(this ScreenShotRemoteWebDriver driver, string script)
        {
            object v = driver.ExecuteScript(string.Format("return {0}", script));

            return((T)v);
        }
Exemplo n.º 3
0
 public static void ExecuteJavaScript(this ScreenShotRemoteWebDriver driver, string script)
 {
     driver.ExecuteScript(script);
 }
Exemplo n.º 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);
 }