当前位置: 首页>>代码示例>>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;未经允许,请勿转载。