本文整理匯總了Java中org.openqa.selenium.Platform.WINDOWS屬性的典型用法代碼示例。如果您正苦於以下問題:Java Platform.WINDOWS屬性的具體用法?Java Platform.WINDOWS怎麽用?Java Platform.WINDOWS使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.openqa.selenium.Platform
的用法示例。
在下文中一共展示了Platform.WINDOWS屬性的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testEquals_OS
@Test
public void testEquals_OS() {
TestEnvironment left = new TestEnvironment(null, null, Platform.WINDOWS);
TestEnvironment right = new TestEnvironment(null, null, Platform.WINDOWS);
assertTrue(left.matches(right));
right = new TestEnvironment(null, null, Platform.LINUX);
assertFalse(left.matches(right));
right = new TestEnvironment(null, null, Platform.XP);
assertTrue(left.matches(right));
right = new TestEnvironment(null, null, Platform.VISTA);
assertTrue(left.matches(right));
right = new TestEnvironment(null, null, Platform.ANY);
assertTrue(left.matches(right));
}
示例2: testCleanupDriver
@Test
public void testCleanupDriver() throws Throwable {
final WebDriver webDriver = mock(WebDriver.class);
TestEnvironment env = new TestEnvironment(null, null, Platform.WINDOWS){
@Override
public WebDriver getWebDriver(){
return webDriver;
}
};
assertEquals(webDriver, env.getWebDriver());
env.cleanupDriver();
verify(webDriver, times(1)).quit();
env.cleanupAllDrivers();
}
示例3: testIsWebDriverAccessedSince
@Test
public void testIsWebDriverAccessedSince() {
TestEnvironment env = new TestEnvironment(TestEnvironment.FF, null, Platform.WINDOWS);
long beforeAccess = System.currentTimeMillis() - 1;
assertFalse(env.isWebDriverAccessedSince(0));
assertFalse(env.isWebDriverAccessedSince(beforeAccess));
env.getWebDriver();
assertTrue(env.isWebDriverAccessedSince(0));
assertTrue(env.isWebDriverAccessedSince(beforeAccess));
assertFalse(env.isWebDriverAccessedSince(System.currentTimeMillis()));
env.cleanupAllDrivers();
}
示例4: addPlatform
@Override
public WebCapabilitiesBuilder addPlatform(final String platform)
{
Platform platformName = null;
switch (platform.toLowerCase())
{
case "windows":
platformName = Platform.WINDOWS;
break;
case "xp":
platformName = Platform.XP;
break;
case "linux":
platformName = Platform.LINUX;
break;
case "mac":
platformName = Platform.MAC;
break;
default:
platformName = Platform.WINDOWS;
break;
}
capabilities.setPlatform(platformName);
return this;
}
示例5: multipleFilters
@CapabilityFilters({
@CapabilityFilter(filterGroup = "pc", browserName = BrowserType.IE),
@CapabilityFilter(platform = Platform.WINDOWS, browserName = { BrowserType.FIREFOX, BrowserType.CHROME }) })
@Test
public void multipleFilters() throws Exception {
assertAssumed(2, 5, 6, 7, 8);
}
示例6: familyParamWindows
@CapabilityFilter(platform = Platform.WINDOWS)
@Test
public void familyParamWindows() throws Exception {
assertAssumed(0, 3, 4);
}
示例7: platformWindows_browserFirefoxChrome
@CapabilityFilter(platform = Platform.WINDOWS, browserName = { BrowserType.FIREFOX, BrowserType.CHROME })
@Test
public void platformWindows_browserFirefoxChrome() throws Exception {
assertAssumed(0, 1, 2, 5, 6, 7, 8);
}
示例8: initDriver
@Before
public void initDriver() throws Exception {
if("local".equals(testType) || "all".equals(testType)) {
if ("firefox".equals(targetBrowser)) {
driver = new FirefoxDriver();
}
if ("chrome".equals(targetBrowser)) {
driver = new ChromeDriver();
}
}
OUTPUT_DIR = System.getProperty("BUILD_OUTPUT");
name = readPropertyOrEnv("BUILD_TAG", getClass().getSimpleName());
DesiredCapabilities desiredCapabilities = new DesiredCapabilities();
desiredCapabilities.setCapability("name", name);
if (targetPlatforme.equalsIgnoreCase("WINDOWS")) {
platforme = Platform.WINDOWS;
}
desiredCapabilities.setCapability(CapabilityType.PLATFORM, platforme);
desiredCapabilities.setJavascriptEnabled(true);
if ("no".equals(videoCapture)) {
desiredCapabilities.setCapability("record-video", false);
}
if ("no".equals(imageCapture)) {
desiredCapabilities.setCapability("record-screenshots", false);
}//we need this if use sauce lab integration
//targetBrowser = readPropertyOrEnv("SELENIUM_BROWSER", targetBrowser);
desiredCapabilities.setBrowserName(targetBrowser);
System.out.println(System.getProperty("webdriver.chrome.driver"));
if("htmlUnit".equals(testType)) {
driver = new HtmlUnitDriver(desiredCapabilities);
}
LoggingPreferences logs = new LoggingPreferences();
logs.enable(LogType.PROFILER, Level.INFO);
desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, logs);
URL gridurl = new URL(gridHubUrl);
if ("grid".equals(testType) || "all".equals(testType)) {
driver = new RemoteWebDriver(gridurl, desiredCapabilities);
}
if (driver instanceof JavascriptExecutor) {
js = (JavascriptExecutor) driver;
}
RemoteWebDriver rd = (RemoteWebDriver) driver;
sessionId = rd.getSessionId().toString();
rd.setLogLevel(Level.INFO);
driver.manage().window().maximize();
recordingStarted = startRecording();
actions = new Actions(driver);
}
示例9: getAdvancedBrowserCapabilities
private DesiredCapabilities getAdvancedBrowserCapabilities(WTFBrowser browser) {
return new DesiredCapabilities(browser.browserNameOnGrid,
browser.version, browser.os != null ? browser.getPlatform()
: Platform.WINDOWS);
}
示例10: createChromeBrowser
private void createChromeBrowser(DesiredCapabilities capabilities) throws MalformedURLException {
if (scope == BrowserScope.LOCAL) {
// Management of chromedriver
ChromeDriverManager.getInstance().setup();
}
// Chrome options
ChromeOptions options = new ChromeOptions();
// Chrome extensions
if (extensions != null && !extensions.isEmpty()) {
for (Map<String, String> extension : extensions) {
InputStream is = getExtensionAsInputStream(extension.values().iterator().next());
if (is != null) {
try {
File crx = File.createTempFile(extension.keySet().iterator().next(), ".crx");
FileUtils.copyInputStreamToFile(is, crx);
options.addExtensions(crx);
} catch (Throwable t) {
log.error("Error loading Chrome extension {} ({} : {})", extension, t.getClass(),
t.getMessage());
}
}
}
}
if (enableScreenCapture) {
// This flag enables the screen sharing
options.addArguments("--enable-usermedia-screen-capturing");
String windowTitle = TEST_SCREEN_SHARE_TITLE_DEFAULT;
if (platform != null
&& (platform == Platform.WINDOWS || platform == Platform.XP || platform == Platform.VISTA
|| platform == Platform.WIN8 || platform == Platform.WIN8_1)) {
windowTitle = TEST_SCREEN_SHARE_TITLE_DEFAULT_WIN;
}
options.addArguments("--auto-select-desktop-capture-source="
+ getProperty(TEST_SCREEN_SHARE_TITLE_PROPERTY, windowTitle));
} else {
// This flag avoids grant the camera
options.addArguments("--use-fake-ui-for-media-stream");
}
// This flag avoids warning in Chrome. See:
// https://code.google.com/p/chromedriver/issues/detail?id=799
options.addArguments("--test-type");
if (protocol == Protocol.FILE) {
// This flag allows reading local files in video tags
options.addArguments("--allow-file-access-from-files");
}
if (!usePhysicalCam) {
// This flag makes using a synthetic video (green with
// spinner) in WebRTC. Or it is needed to combine with
// use-file-for-fake-video-capture to use a file faking the
// cam
options.addArguments("--use-fake-device-for-media-stream=fps=30");
if (video != null && (isLocal() || isDocker())) {
if (!Files.exists(Paths.get(video))) {
throw new RuntimeException("Trying to create a browser using video file " + video
+ ", but this file doesn't exist.");
}
log.debug("Using video {} in browser {}", video, id);
options.addArguments("--use-file-for-fake-video-capture=" + video);
}
}
capabilities.setCapability(ChromeOptions.CAPABILITY, options);
capabilities.setBrowserName(DesiredCapabilities.chrome().getBrowserName());
createDriver(capabilities, options);
}