Example usage for org.openqa.selenium.firefox FirefoxProfile fromJson

List of usage examples for org.openqa.selenium.firefox FirefoxProfile fromJson

Introduction

In this page you can find the example usage for org.openqa.selenium.firefox FirefoxProfile fromJson.

Prototype

public static FirefoxProfile fromJson(String json) throws IOException 

Source Link

Usage

From source file:org.apache.nutch.protocol.webdriver.driver.NutchFirefoxDriver.java

License:Apache License

private static FirefoxProfile getProfile(Capabilities cap) {
    FirefoxProfile profile = null;//from  w w  w  .  jav  a 2  s  .c om
    Object raw = null;
    if (cap != null && cap.getCapability(PROFILE) != null) {
        raw = cap.getCapability(PROFILE);
    }
    if (raw != null) {
        if (raw instanceof FirefoxProfile) {
            profile = (FirefoxProfile) raw;
        } else if (raw instanceof String) {
            try {
                profile = FirefoxProfile.fromJson((String) raw);
            } catch (IOException e) {
                throw new WebDriverException(e);
            }
        }
    }
    if (profile == null) {
        profile = new FirefoxProfile();
    }
    return profile;
}