Java Code Examples for org.openqa.selenium.Capabilities#asMap()
The following examples show how to use
org.openqa.selenium.Capabilities#asMap() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DefaultSession.java From selenium with Apache License 2.0 | 6 votes |
private Map<String, Object> getDescription(WebDriver instance, Capabilities capabilities) { DesiredCapabilities caps = new DesiredCapabilities(capabilities.asMap()); caps.setJavascriptEnabled(instance instanceof JavascriptExecutor); if (instance instanceof TakesScreenshot) { caps.setCapability(CapabilityType.TAKES_SCREENSHOT, true); } if (instance instanceof LocationContext) { caps.setCapability(CapabilityType.SUPPORTS_LOCATION_CONTEXT, true); } if (instance instanceof ApplicationCache) { caps.setCapability(CapabilityType.SUPPORTS_APPLICATION_CACHE, true); } if (instance instanceof NetworkConnection) { caps.setCapability(CapabilityType.SUPPORTS_NETWORK_CONNECTION, true); } if (instance instanceof WebStorage) { caps.setCapability(CapabilityType.SUPPORTS_WEB_STORAGE, true); } if (instance instanceof Rotatable) { caps.setCapability(CapabilityType.ROTATABLE, true); } if (instance instanceof HasTouchScreen) { caps.setCapability(CapabilityType.HAS_TOUCHSCREEN, true); } return caps.asMap(); }
Example 2
Source File: UiDriverFactory.java From qaf with MIT License | 5 votes |
private Browsers(Capabilities desiredCapabilities) { this.desiredCapabilities = new DesiredCapabilities(desiredCapabilities.asMap()); this.desiredCapabilities.setCapability(CapabilityType.SUPPORTS_JAVASCRIPT,true); this.desiredCapabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true); this.desiredCapabilities.setCapability(CapabilityType.SUPPORTS_FINDING_BY_CSS, true); }
Example 3
Source File: SeleniumDriverSetup.java From hsac-fitnesse-fixtures with Apache License 2.0 | 5 votes |
protected Map<String, ?> getCapabilitiesToDescribe(Capabilities capabilities) { Map<String, ?> result = capabilities.asMap(); Collection<String> keysToMask = getSecretCapabilities(); if (!keysToMask.isEmpty()) { result = getEnvironment().getSecretMasker().replaceSecrets(keysToMask, result); } return result; }
Example 4
Source File: NewAppiumSessionPayload.java From java-client with Apache License 2.0 | 5 votes |
/** * Creates instance of {@link NewAppiumSessionPayload}. * * @param caps capabilities to create a new session * @return instance of {@link NewAppiumSessionPayload} * @throws IOException On file system I/O error. */ public static NewAppiumSessionPayload create(Capabilities caps) throws IOException { boolean forceMobileJSONWP = ofNullable(caps.getCapability(FORCE_MJSONWP)) .map(o -> Boolean.class.isAssignableFrom(o.getClass()) && Boolean.class.cast(o)) .orElse(false); HashMap<String, ?> capabilityMap = new HashMap<>(caps.asMap()); capabilityMap.remove(FORCE_MJSONWP); Map<String, ?> source = of(DESIRED_CAPABILITIES, capabilityMap); String json = new Json().toJson(source); return new NewAppiumSessionPayload(new StringReader(json), forceMobileJSONWP); }
Example 5
Source File: ExecutionContextTest.java From xframium-java with GNU General Public License v3.0 | 4 votes |
public void setDesiredCapabilities( Capabilities c ) { if ( c != null ) this.c = c.asMap(); }
Example 6
Source File: ExecutionContextTest.java From xframium-java with GNU General Public License v3.0 | 4 votes |
public void setDerivedCapabilities( Capabilities c ) { if ( c != null ) this.dC = c.asMap(); }