Example usage for org.openqa.selenium Keys CONTROL

List of usage examples for org.openqa.selenium Keys CONTROL

Introduction

In this page you can find the example usage for org.openqa.selenium Keys CONTROL.

Prototype

Keys CONTROL

To view the source code for org.openqa.selenium Keys CONTROL.

Click Source Link

Usage

From source file:com.pages.CompanyLoginpage.java

public static void CompanyLogin(WebDriver driver, String Companynumber) throws InterruptedException {
    String url = driver.getCurrentUrl();
    if (URL.equalsIgnoreCase(url)) {
        driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
        common.Wait_Until_ElementVisible(driver, LicenseAgreement_popup);
        driver.findElement(By.xpath("//button[@id='btnEULAAgree']")).click();
        //Thread.sleep(1000);
        driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
    } else {// ww w  .j  a  va 2  s  . co  m
        driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
        JavascriptExecutor js = (JavascriptExecutor) driver;
        js.executeScript(String.format("window.localStorage.clear();"));
        driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
        driver.manage().deleteAllCookies();
        Actions act = new Actions(driver);
        act.sendKeys(Keys.CONTROL.F5).perform();
        driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
        driver.findElement(By.xpath("//button[@id='btnEULAAgree']")).click();
        //Thread.sleep(1000);
        driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
        driver.manage().timeouts().implicitlyWait(1000, TimeUnit.SECONDS);

    }

    JavascriptExecutor js = (JavascriptExecutor) driver;
    js.executeScript("return document.readyState").equals("complete");
    //Thread.sleep(1000);
    WebDriverWait ww = new WebDriverWait(driver, 30);
    ww.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(AccessKey_fld_xpath)));
    driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
    driver.findElement(By.xpath(AccessKey_fld_xpath)).sendKeys(Companynumber);
    driver.manage().timeouts().implicitlyWait(100, TimeUnit.SECONDS);
    driver.findElement(By.xpath(Download_btn_xpath)).click();
    driver.manage().timeouts().implicitlyWait(1000, TimeUnit.SECONDS);
    // Thread.sleep(500);
    ww.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(HomePage_NavBar)));
}

From source file:com.pentaho.gui.web.puc.BrowseFiles.java

License:Apache License

/**
 * This method will empty a folder in the repository given the full path to it, including the folder name
 *
 * Ex. "/public/plugin-samples/pentaho-cdf-dd" the SelectFolder method will be called with the path provided, it it
 * returns false an info will be shown on the logs saying the file wasn't deleted for it wasn't found. If it returns
 * true, all files shown on the files table will be selected, Delete button will be clicked on File Actions, it will
 * wait for popup and confirm the delete action.
 *
 * @param path/* w  w w .ja  v  a  2 s  .c om*/
 */
public void EmptyFolder(String path) {
    if (SelectFolder(path)) {
        WebElement listFiles = this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER,
                By.xpath("//div[@id='fileBrowserFiles']/div[2]"));
        List<WebElement> AllFolderFiles = listFiles.findElements(By.xpath("//div[@class='title']"));

        // Check if the widget named exist
        if (AllFolderFiles != null) {
            if (AllFolderFiles.size() > 0) {
                WebElement[] arrayAllFolderFiles = new WebElement[AllFolderFiles.size()];
                AllFolderFiles.toArray(arrayAllFolderFiles);

                // Where we want to select three files
                // <the widget>
                // <the widget>.cdfde
                // <the widget>.component.xml
                // To do that we select each file (using the CONTROL key) and delete them.
                Actions action = new Actions(this.DRIVER);
                action.keyDown(Keys.CONTROL);
                for (WebElement arrayAllFolderFile : arrayAllFolderFiles) {
                    action.click(arrayAllFolderFile);
                }
                action.keyUp(Keys.CONTROL);
                action.build().perform();

                // Here we still in the iframe
                assertNotNull(this.elemHelper.WaitForElementVisibility(this.DRIVER, By.id("deleteButton")));
                this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER, By.id("deleteButton")).click();
                // Go back to root html
                this.DRIVER.switchTo().defaultContent();
                assertEquals(this.elemHelper
                        .WaitForElementPresenceAndVisible(this.DRIVER, By.cssSelector("div.gwt-HTML"))
                        .getText(), "Are you sure you want to move all selected items to the trash?");
                this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER, By.id("okButton")).click();

                // wait for visibility of waiting pop-up
                this.elemHelper.WaitForElementInvisibility(this.DRIVER,
                        By.xpath("//div[@class='busy-indicator-container waitPopup']"));

                this.elemHelper.WaitForElementInvisibility(this.DRIVER,
                        By.xpath("//div[@class='spinner large-spinner']"));
                this.elemHelper.WaitForElementInvisibility(this.DRIVER,
                        By.xpath("(//div[@class='spinner large-spinner'])[2]"));

            }
        }
    } else {
        LOG.info("folder not emptied for it was not found");
    }
}

From source file:com.pentaho.gui.web.puc.BrowseFiles.java

License:Apache License

/**
 * Given the path to a folder this method will delete all files located in that folder that contain a specific string
 * in the name// w  w w .j a v a  2s. c  o m
 *
 * Ex. "/public/plugin-samples/pentaho-cdf-dd" the SelectFolder method will be called with the path provided, it it
 * returns false an info will be shown on the logs saying the file wasn't deleted for it wasn't found.
 *
 * If it returns true, all files containing string "name" provided in the name will be selected, Delete button will be
 * clicked on File Actions, it will wait for popup and confirm the delete action.
 *
 * @param path
 * @param name
 */
public void DeleteMultipleFilesByName(String path, String name) {
    LOG.debug("DeleteMultipleFilesByName::Enter");
    if (SelectFolder(path)) {
        LOG.debug("Deleting [" + path + "] with name [" + name + "]");

        WebElement elemWidgetFile = this.elemHelper.WaitForElementPresence(this.DRIVER,
                By.cssSelector("div[title='" + name + ".wcdf']"), 1);
        if (elemWidgetFile != null) {
            WebElement listFiles = this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER,
                    By.xpath("//div[@id='fileBrowserFiles']/div[2]"));
            List<WebElement> theNamedFiles = listFiles
                    .findElements(By.xpath("//div[@class='title' and contains(text(),'" + name + "')]"));

            // Check if the widget named exist
            if (theNamedFiles != null) {
                if (theNamedFiles.size() > 0) {
                    WebElement[] arraytheNamedFiles = new WebElement[theNamedFiles.size()];
                    theNamedFiles.toArray(arraytheNamedFiles);

                    // Where we want to select three files
                    // <the widget>
                    // <the widget>.cdfde
                    // <the widget>.component.xml
                    // To do that we select each file (using the CONTROL key) and delete them.
                    Actions action = new Actions(this.DRIVER);
                    action.keyDown(Keys.CONTROL);
                    for (WebElement arraytheNamedFile : arraytheNamedFiles) {
                        action.click(arraytheNamedFile);
                    }
                    action.keyUp(Keys.CONTROL);
                    action.build().perform();

                    // Here we still in the iframe
                    assertNotNull(this.elemHelper.WaitForElementVisibility(this.DRIVER, By.id("deleteButton")));
                    this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER, By.id("deleteButton"))
                            .click();
                    // Go back to root html
                    this.DRIVER.switchTo().defaultContent();
                    assertEquals(
                            this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER,
                                    By.cssSelector("div.gwt-HTML")).getText(),
                            "Are you sure you want to move all selected items to the trash?");
                    this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER, By.id("okButton")).click();

                    // wait for visibility of waiting pop-up
                    this.elemHelper.WaitForElementInvisibility(this.DRIVER,
                            By.xpath("//div[@class='busy-indicator-container waitPopup']"));

                    assertNotNull(this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER,
                            By.id("applicationShell")));
                    assertNotNull(this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER,
                            By.xpath("//iframe[@id='browser.perspective']")));
                    this.DRIVER.switchTo().frame("browser.perspective");

                    assertNotNull(this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER,
                            By.id("fileBrowser")));
                    this.elemHelper.WaitForElementInvisibility(this.DRIVER,
                            By.xpath("//div[@class='spinner large-spinner']"));
                    this.elemHelper.WaitForElementInvisibility(this.DRIVER,
                            By.xpath("(//div[@class='spinner large-spinner'])[2]"));

                    this.elemHelper.Click(this.DRIVER, By.id("refreshBrowserIcon"));
                    this.elemHelper.WaitForElementInvisibility(this.DRIVER,
                            By.xpath("//div[@class='spinner large-spinner']"));
                    this.elemHelper.WaitForElementInvisibility(this.DRIVER,
                            By.xpath("(//div[@class='spinner large-spinner'])[2]"));

                    // Assert Panels
                    assertNotNull(this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER,
                            By.xpath("//div[@id='fileBrowserFolders']")));
                    assertNotNull(this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER,
                            By.xpath("//div[@id='fileBrowserFiles']")));
                    assertNotNull(this.elemHelper.WaitForElementPresenceAndVisible(this.DRIVER,
                            By.xpath("//div[@id='fileBrowserButtons']")));
                    LOG.info("Exit: Assert browser perspective shown");
                } else {
                    LOG.debug("No file exist!");
                }
            } else {
                LOG.debug("Null - No file exist!");
            }
        } else {
            LOG.warn("The widget does not exist.");
        }
    } else {
        LOG.info("Files were not deleted or folder was not found!");
    }
}

From source file:com.qkn.automation.pages.LoginPage.java

public void loginWithValidCredentialsForAndroidQKN(String email, String password) throws Exception {
    try {/* ww  w . j a  va 2s .  c  o  m*/
        WebDriverWait wait = new WebDriverWait(pageDriver, 30);
        //         pageDriver.findElement(By.name(pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE")))
        //         .click();
        findElementByXpathAndClick(pageDriver, pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE"));
        //         pageDriver.findElement(By.xpath(pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE"))).click();

        //         Thread.sleep(TestConstants.MINSLEEPTIME);
        //applitools to test sign in page 
        //   eyes.checkWindow("Sign in page");   
        //
        wait.until(
                ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME"))));
        pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a");
        pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE);
        System.out.println("Before send keys for username");
        pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email);
        pageDriver.findElement(By.xpath(pageprops.getProperty("LOGIN_PWD2"))).sendKeys(Keys.CONTROL + "a");
        pageDriver.findElement(By.xpath(pageprops.getProperty("LOGIN_PWD2"))).sendKeys(Keys.DELETE);
        //   Thread.sleep(3000);
        System.out.println("Before sendkeys for password");
        pageDriver.findElement(By.xpath(pageprops.getProperty("LOGIN_PWD2"))).sendKeys(password);
        //         Thread.sleep(5000);

        //Require this to run on local to hide the keyboard not required on sauce labs .
        //         pageDriver.navigate().back();

        /*JavascriptExecutor js = (JavascriptExecutor) pageDriver;
        HashMap flickObject = new HashMap();
        flickObject.put("endX", 0);
        flickObject.put("endY", 0);
        flickObject.put("touchCount", 1);
        js.executeScript("mobile: swipe", flickObject);*/

        // Added by ashwini
        //  eyes.checkWindow("Sign in Page");   
        findElementByXpathAndClick(pageDriver, pageprops.getProperty("SIGNIN_BTN"));
        //         pageDriver.findElement(By.xpath(pageprops.getProperty("SIGNIN_BTN"))).click();
        /*JavascriptExecutor jse = (JavascriptExecutor) pageDriver;
        jse.executeScript("UIATarget.localTarget().frontMostApp().keyboard().buttons()['Go'].tap();");      */
        //   Thread.sleep(20000);

        //         Thread.sleep(15000);
        /*wait.until(ExpectedConditions.visibilityOfElementLocated(By
              .name(pageprops
             .getProperty("OK_BTN"))));*/
        //            if(pageDriver.findElements(By.xpath("//android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.Button[1]")).size()!=0)
        //            {
        //               MintLogger.log(Level.INFO,"Welcome to quicken screen displayed So click on OK button");
        //               
        //            }
        wait.until(
                ExpectedConditions.visibilityOfElementLocated(By.xpath(pageprops.getProperty("SIGNINOK_BTN"))));
        findElementByXpathAndClick(pageDriver, pageprops.getProperty("SIGNINOK_BTN"));
        QuickenLogger.log(Level.INFO,
                "Login successfull with " + email + " as username and " + password + " as password");

        //         if (pageDriver.getPageSource().contains("OK")) {
        ////            pageDriver.findElement(By.name("OK")).click();
        //            pageDriver.findElement(By.xpath("//android.widget.FrameLayout[1]/android.widget.FrameLayout[1]/android.widget.LinearLayout[1]/android.widget.LinearLayout[2]/android.widget.Button[1]")).click();
        //            System.out.println("Login successfull with "+email+" as username and "+password+" as password");
        //         }

        Thread.sleep(TestConstants.MINSLEEPTIME);
        /*
        if (tabname.equalsIgnoreCase("OVERVIEW")){
        pageDriver.findElement(By.name(pageprops.getProperty("OVERVIEW_TAB")))
        .click();
         }
        else if(tabname.equalsIgnoreCase("UPDATES")){
        pageDriver.findElement(By.name(pageprops.getProperty("UPDATES_TAB")))
        .click();
            }*/
    }

    //added 
    catch (Exception e) {
        MintLogger.log(Level.INFO, "Unable to Sign in ");
        e.printStackTrace();
    }
}

From source file:com.qkn.automation.pages.LoginPage.java

public void loginWithInValidCredentials(String email, String password) throws Exception {
    QuickenLogger.log(Level.INFO, "loginWithInValidCredentials");
    WebDriverWait wait = new WebDriverWait(pageDriver, 30);
    pageDriver.findElement(By.name(pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE"))).click();
    Thread.sleep(20000);/*from   w w w  .  java  2s.co  m*/
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME"))));
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a");
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE);
    System.out.println("Before send keys for username");
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email);
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.CONTROL + "a");
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.DELETE);
    //   Thread.sleep(3000);
    System.out.println("Before sendkeys for password");
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(password);
    Thread.sleep(5000);
    pageDriver.navigate().back();

    pageDriver.findElement(By.xpath(pageprops.getProperty("SIGNIN_BTN"))).click();

}

From source file:com.qkn.automation.pages.LoginPage.java

public void loginViaGetStarted(String email, String password) throws Exception {
    MintLogger.log(Level.INFO, "loginWithInValidCredentials");
    WebDriverWait wait = new WebDriverWait(pageDriver, 30);
    pageDriver.findElement(By.name("Get started")).click();
    Thread.sleep(4000);//from  w w w .j a  v a  2 s  .  c o  m
    /*JavascriptExecutor js = (JavascriptExecutor) pageDriver;
    HashMap flickObject = new HashMap();
    flickObject.put("endX", 0);
    flickObject.put("endY", 0);
    flickObject.put("touchCount", 1);
    js.executeScript("mobile: swipe", flickObject);
    Thread.sleep(4000);      */
    pageDriver.findElement(By.name(pageprops.getProperty("SINGUP_BUTTON_GETSTARTEDPAGE"))).click();
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME"))));
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a");
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE);
    System.out.println("Before send keys for username");
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email);
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.CONTROL + "a");
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.DELETE);
    //      Thread.sleep(3000);
    System.out.println("Before sendkeys for password");
    pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(password);
    Thread.sleep(3000);

    pageDriver.navigate().back();
    Thread.sleep(1000);
    pageDriver.findElement(By.xpath(pageprops.getProperty("SIGNIN_BTN"))).click();

    /*      JavascriptExecutor jse = (JavascriptExecutor) pageDriver;
    jse.executeScript("UIATarget.localTarget().frontMostApp().keyboard().buttons()['Go'].tap();");   */
    Thread.sleep(15000);
    wait.until(ExpectedConditions.visibilityOfElementLocated(By.name(pageprops.getProperty("OK_BTN"))));

    if (pageDriver.getPageSource().contains("OK")) {
        pageDriver.findElement(By.name("OK")).click();
    }

    Thread.sleep(13000);
}

From source file:com.qkn.automation.pages.LoginPage.java

public void loginWithValidCredentialsForAndroidQKN2(String email, String password) throws Exception {
    try {//w  ww .  j a  v  a2s .  c o m
        WebDriverWait wait = new WebDriverWait(pageDriver, 30);
        findElementByXpathAndClick(pageDriver, pageprops.getProperty("SINGUP_BUTTON_LOGINPAGE"));
        wait.until(
                ExpectedConditions.visibilityOfElementLocated(By.id(pageprops.getProperty("LOGIN_USERNAME"))));
        pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.CONTROL + "a");
        pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(Keys.DELETE);
        System.out.println("Before send keys for username");
        pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_USERNAME"))).sendKeys(email);
        pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.CONTROL + "a");
        pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(Keys.DELETE);
        System.out.println("Before sendkeys for password");
        pageDriver.findElement(By.id(pageprops.getProperty("LOGIN_PWD"))).sendKeys(password);
        findElementByXpathAndClick(pageDriver, pageprops.getProperty("SIGNIN_BTN"));

        wait.until(
                ExpectedConditions.visibilityOfElementLocated(By.xpath(pageprops.getProperty("SIGNINOK_BTN"))));
        findElementByXpathAndClick(pageDriver, pageprops.getProperty("SIGNINOK_BTN"));
        QuickenLogger.log(Level.INFO,
                "Login successfull with " + email + " as username and " + password + " as password");

        Thread.sleep(TestConstants.MINSLEEPTIME);

    }

    //added 
    catch (Exception e) {
        MintLogger.log(Level.INFO, "Unable to Sign in ");
        e.printStackTrace();
    }
}

From source file:com.screenslicer.core.util.BrowserUtil.java

License:Open Source License

public static String newWindow(Browser browser, boolean cleanupWindows) throws ActionFailed {
    try {/*from w ww  . j  av  a  2s. com*/
        handleNewWindows(browser, browser.getWindowHandle(), cleanupWindows);
        Set<String> origHandles = new HashSet<String>(browser.getWindowHandles());
        try {
            browser.getKeyboard().sendKeys(Keys.chord(Keys.CONTROL + "n"));
        } catch (Browser.Retry r) {
            throw r;
        } catch (Browser.Fatal f) {
            throw f;
        } catch (Throwable t) {
            Log.exception(t);
        }
        Collection<String> handles = new HashSet<String>(browser.getWindowHandles());
        handles.removeAll(origHandles);
        if (!handles.isEmpty()) {
            browser.switchTo().window(handles.iterator().next());
        } else {
            browser.executeScript("window.open('');");
            handles = new HashSet<String>(browser.getWindowHandles());
            handles.removeAll(origHandles);
            if (!handles.isEmpty()) {
                browser.switchTo().window(handles.iterator().next());
            }
        }
        return browser.getWindowHandle();
    } catch (Browser.Retry r) {
        throw r;
    } catch (Browser.Fatal f) {
        throw f;
    } catch (Throwable t) {
        throw new ActionFailed(t);
    }
}

From source file:com.screenslicer.core.util.Util.java

License:Open Source License

public static String newWindow(RemoteWebDriver driver) throws ActionFailed {
    try {//from   w  ww  . java  2 s  . c o m
        String origHandle = driver.getWindowHandle();
        cleanUpNewWindows(driver, origHandle);
        try {
            driver.getKeyboard().sendKeys(Keys.chord(Keys.CONTROL + "n"));
        } catch (Throwable t) {
            Log.exception(t);
        }
        Util.driverSleepStartup();
        Collection<String> handles = new HashSet<String>(driver.getWindowHandles());
        handles.remove(origHandle);
        if (!handles.isEmpty()) {
            driver.switchTo().window(handles.iterator().next());
        } else {
            driver.executeScript("window.open('');");
            Util.driverSleepStartup();
            handles = new HashSet<String>(driver.getWindowHandles());
            handles.remove(origHandle);
            if (!handles.isEmpty()) {
                driver.switchTo().window(handles.iterator().next());
            }
        }
        return driver.getWindowHandle();
    } catch (Throwable t) {
        Log.exception(t);
        throw new ActionFailed(t);
    }
}

From source file:com.stratio.qa.specs.CommonG.java

License:Apache License

/**
 * Capture a snapshot or an evidence in the driver
 *
 * @param driver driver used for testing
 * @param type type/*from ww w. j a  v  a  2s  . c  o m*/
 * @param suffix suffix
 * @return String
 */
public String captureEvidence(WebDriver driver, String type, String suffix) {
    String testSuffix = System.getProperty("TESTSUFFIX");
    String dir = "./target/executions/";
    if (testSuffix != null) {
        dir = dir + testSuffix + "/";
    }

    String clazz = ThreadProperty.get("class");
    String currentBrowser = ThreadProperty.get("browser");
    String currentData = ThreadProperty.get("dataSet");

    if (!currentData.equals("")) {
        currentData = currentData.replaceAll("[\\\\|\\/|\\|\\s|:|\\*]", "_");
    }

    if (!"".equals(currentData)) {
        currentData = "-" + HashUtils.doHash(currentData);
    }

    Timestamp ts = new Timestamp(new java.util.Date().getTime());
    String outputFile = dir + clazz + "/" + ThreadProperty.get("feature") + "." + ThreadProperty.get("scenario")
            + "/" + currentBrowser + currentData + ts.toString() + suffix;

    outputFile = outputFile.replaceAll(" ", "_");

    if (type.endsWith("htmlSource")) {
        if (type.equals("framehtmlSource")) {
            boolean isFrame = (Boolean) ((JavascriptExecutor) driver)
                    .executeScript("return window.top != window.self");

            if (isFrame) {
                outputFile = outputFile + "frame.html";
            } else {
                outputFile = "";
            }
        } else if (type.equals("htmlSource")) {
            driver.switchTo().defaultContent();
            outputFile = outputFile + ".html";
        }

        if (!outputFile.equals("")) {
            String source = ((RemoteWebDriver) driver).getPageSource();

            File fout = new File(outputFile);
            boolean dirs = fout.getParentFile().mkdirs();

            FileOutputStream fos;
            try {
                fos = new FileOutputStream(fout, true);
                Writer out = new OutputStreamWriter(fos, "UTF8");
                PrintWriter writer = new PrintWriter(out, false);
                writer.append(source);
                writer.close();
                out.close();
            } catch (IOException e) {
                logger.error("Exception on evidence capture", e);
            }
        }

    } else if ("screenCapture".equals(type)) {
        outputFile = outputFile + ".png";
        File file = null;
        driver.switchTo().defaultContent();
        ((Locatable) driver.findElement(By.tagName("body"))).getCoordinates().inViewPort();

        if (currentBrowser.startsWith("chrome") || currentBrowser.startsWith("droidemu")) {
            Actions actions = new Actions(driver);
            actions.keyDown(Keys.CONTROL).sendKeys(Keys.HOME).perform();
            actions.keyUp(Keys.CONTROL).perform();

            file = chromeFullScreenCapture(driver);
        } else {
            file = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
        }
        try {
            FileUtils.copyFile(file, new File(outputFile));
        } catch (IOException e) {
            logger.error("Exception on copying browser screen capture", e);
        }
    }

    return outputFile;

}