當前位置: 首頁>>代碼示例>>Java>>正文


Java Platform.valueOf方法代碼示例

本文整理匯總了Java中org.openqa.selenium.Platform.valueOf方法的典型用法代碼示例。如果您正苦於以下問題:Java Platform.valueOf方法的具體用法?Java Platform.valueOf怎麽用?Java Platform.valueOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openqa.selenium.Platform的用法示例。


在下文中一共展示了Platform.valueOf方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getValue

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
private Object getValue( String clazz, String value )
{
    Object rtn = null;

    switch ( clazz )
    {
        case "BOOLEAN":
            rtn = Boolean.parseBoolean( value );
            break;
            
        case "OBJECT":
            rtn = value;
            break;
            
        case "STRING":
            rtn = value;
            break;
            
        case "PLATFORM":
            rtn = ((value != null) ? Platform.valueOf( value.toUpperCase() ) : null );
            break;
    }

    return rtn;
}
 
開發者ID:xframium,項目名稱:xframium-java,代碼行數:26,代碼來源:SQLApplicationProvider.java

示例2: buildDesiredCapabilities

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
/**
 * Here you can add your capabilities you want to use.
 *
 * @see https://code.google.com/p/chromedriver/wiki/CapabilitiesAndSwitches#List_of_recognized_capabilities
 */
protected void buildDesiredCapabilities() {
	DesiredCapabilities capabilities = createDesiredCapabilitiesForChrome();

	// get Platform from environment
	String platformString = System.getenv("PLATFORM");
	if (platformString == null) {
		platformString = Platform.WINDOWS.toString();
	}
	Platform platform = Platform.valueOf(platformString);
	capabilities.setCapability("platform", platform);

	// set browser version
	String versionString = System.getenv("VERSION");
	if (versionString != null) {
		capabilities.setVersion("38");
	}

	// if chrome options are not build yet, we have to handle it
	if (chromeOptions == null) {
		buildChromeOptions();
	}
	capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);

	this.desiredCapabilities = capabilities;
}
 
開發者ID:quitschibo,項目名稱:chrome-extension-selenium-example,代碼行數:31,代碼來源:RemoteDriverConfig.java

示例3: getPlatform

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
private static Platform getPlatform(TestSlot slot) {
  Object o = slot.getCapabilities().get(CapabilityType.PLATFORM);
  if (o == null) {
    return Platform.ANY;
  } else {
    if (o instanceof String) {
      return Platform.valueOf((String) o);
    } else if (o instanceof Platform) {
      return (Platform) o;
    } else {
      throw new GridException("Cannot cast " + o + " to org.openqa.selenium.Platform");
    }
  }
}
 
開發者ID:aimmac23,項目名稱:selenium-reliable-node-plugin,代碼行數:15,代碼來源:WebProxyHtmlRendererBeta.java

示例4: extractPlatform

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
/**
 * Resolves a platform capability to a Platform instance.
 *
 * Taken from DefaultCapabilityMatcher with small modifications.
 *
 * @param o Object to resolve to a Platform
 *
 * @return Resolved Platform instance or <code>null</code>.
 */
Platform extractPlatform(Object o) {
    if (o == null) {
        return null;
    }
    if (o instanceof Platform) {
        return (Platform) o;
    } else if (o instanceof String) {
        String name = o.toString();
        try {
            return Platform.valueOf(name.toUpperCase());
        } catch (IllegalArgumentException e) {
            // no exact match, continue to look for a partial match
        }
        for (Platform os : Platform.values()) {
            for (String matcher : os.getPartOfOsName()) {
                if ("".equals(matcher))
                    continue;
                if (name.equalsIgnoreCase(matcher)) {
                    return os;
                }
            }
        }
        return null;
    } else {
        return null;
    }
}
 
開發者ID:jabbrwcky,項目名稱:selenium-api,代碼行數:37,代碼來源:PlatformMatcher.java

示例5: getGridPlatform

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
/**
 * @return the {@link Platform} specified in the property {@value #PROP_GRID_PLATFORM};
 *         null, if not defined
 */
public static Platform getGridPlatform() {
	String value = getOptionalProperty(PROP_GRID_PLATFORM);
	return (value == null) ? null : Platform.valueOf(value.toUpperCase());	
}
 
開發者ID:alb-i986,項目名稱:selenium-tinafw,代碼行數:9,代碼來源:Config.java

示例6: getPlatformType

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
public Platform getPlatformType() {
  return Platform.valueOf(getPlatform().toUpperCase());
}
 
開發者ID:Kurento,項目名稱:kurento-java,代碼行數:4,代碼來源:BrowserInstance.java

示例7: SeleniumManager

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
/**
 * {@link SeleniumManager} constructor managed by spring
 * 
 * @param defaultDomain domain the whole selenium related SenBot will work from
 * @param seleniumHubIP if running on a grid this is the hub ip to be used
 * @param target The target environements to run the selenium tests on
 * @param defaultWindowWidth browser window width to start the browser with
 * @param defaultWindowHeight browser window height to start the browser with
 * @param aTimeout implicit timeout to be used by selenium when performing a dom lookup or page refresh
 * @throws IOException
 */
public SeleniumManager(
		String defaultDomain, 
		String seleniumHubIP, 
		String target, 
		int defaultWindowWidth, 
		int defaultWindowHeight, 
		int aTimeout, 
		String implicitTimeout,
    String webdriverCreationHookClassName)
    throws IOException, ClassNotFoundException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchMethodException {

  if(!StringUtils.isBlank(webdriverCreationHookClassName)) {
    Constructor<?> constructor = Class.forName(webdriverCreationHookClassName).getConstructor();
    webDriverCreationHook = (WebDriverCreationHook) constructor.newInstance();
  }

    
    if(defaultDomain != null) {
    	if(defaultDomain.toLowerCase().startsWith("http")) {
    		this.defaultDomain = defaultDomain;        		
    	}
    	else {        		
    		this.defaultDomain = "http://" + defaultDomain;
    	}
    }
    
    this.defaultWindowWidth = defaultWindowWidth;
    this.defaultWindowHeight = defaultWindowHeight;
    this.timeout = aTimeout;
    if (!StringUtils.isBlank(implicitTimeout)) {
        this.implicitTimeout = Integer.parseInt(implicitTimeout);
    }
    this.seleniumHub = (StringUtils.isBlank(seleniumHubIP)) ? null : new URL(seleniumHubIP);

    if (StringUtils.isBlank(target)) {
        throw new IllegalArgumentException("The selenium target environment property cannot be blank. Refer to senbot-runner.properties");
    } else {
        for (String ii : target.split(";")) {
            String[] parts = ii.split(",");
String browserVersion = parts.length > 1 ? parts[1].trim() : "ANY";
Platform platform = Platform.valueOf(parts.length > 2 ? parts[2].trim() : "ANY");
String locale = parts.length > 3 ? parts[3].trim() : null;
TestEnvironment testEnvironment = new TestEnvironment(parts[0].trim(), 
            		browserVersion, 
            		platform,
            		locale);
            seleniumTestEnvironments.add(testEnvironment);
        }
    }
}
 
開發者ID:gfk-ba,項目名稱:senbot,代碼行數:62,代碼來源:SeleniumManager.java

示例8: readPlatform

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
private static Platform readPlatform(String platformText) {
    if (platformText == null) {
        return null;
    }
    else return Platform.valueOf(platformText.toUpperCase());
}
 
開發者ID:galenframework,項目名稱:galen,代碼行數:7,代碼來源:GalenPageTestReader.java

示例9: connectToDriverForVersionOnAt

import org.openqa.selenium.Platform; //導入方法依賴的package包/類
/**
 * Connects SeleniumHelper to a remote web driver.
 * @param browser name of browser to connect to.
 * @param version version of browser.
 * @param platformName platform browser must run on.
 * @param url url to connect to browser.
 * @return true.
 * @throws MalformedURLException if supplied url can not be transformed to URL.
 */
public boolean connectToDriverForVersionOnAt(String browser, String version, String platformName, String url)
        throws MalformedURLException {
    Platform platform = Platform.valueOf(platformName);
    DesiredCapabilities desiredCapabilities = new DesiredCapabilities(browser, version, platform);
    desiredCapabilities.setVersion(version);
    return createAndSetRemoteDriver(url, desiredCapabilities);
}
 
開發者ID:fhoeben,項目名稱:hsac-fitnesse-fixtures,代碼行數:17,代碼來源:SeleniumDriverSetup.java


注:本文中的org.openqa.selenium.Platform.valueOf方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。