Skip to content

Commit

Permalink
appium#696 FIX:
Browse files Browse the repository at this point in the history
 - changes from the appium#698
 - selenium-java was updated to 3.5.1
 - org.apache.commons-lang3 was updated to 3.6
 - org.springframework.spring-context was updated to 4.3.10.RELEASE
 - the element genering was improved. appium#696 FIX
 - some improvements of AppiumDriver#context
  • Loading branch information
TikhomirovSergey authored and SrinivasanTarget committed Sep 3, 2017
1 parent 4e244cc commit 6eb0053
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Expand Up @@ -55,17 +55,17 @@ compileJava {
}

dependencies {
compile('org.seleniumhq.selenium:selenium-java:3.4.0'){
compile('org.seleniumhq.selenium:selenium-java:3.5.1'){
exclude module: 'cglib'
exclude group: 'com.google.code.gson'
}
compile 'com.google.code.gson:gson:2.8.1'
compile 'org.apache.httpcomponents:httpclient:4.5.3'
compile 'cglib:cglib:3.2.5'
compile 'commons-validator:commons-validator:1.6'
compile 'org.apache.commons:commons-lang3:3.5'
compile 'org.apache.commons:commons-lang3:3.6'
compile 'commons-io:commons-io:2.5'
compile 'org.springframework:spring-context:4.3.8.RELEASE'
compile 'org.springframework:spring-context:4.3.10.RELEASE'
compile 'org.aspectj:aspectjweaver:1.8.10'
compile 'org.openpnp:opencv:3.2.0-1'

Expand Down
9 changes: 7 additions & 2 deletions src/main/java/io/appium/java_client/AppiumDriver.java
Expand Up @@ -209,8 +209,13 @@ public List<T> findElementsByXPath(String using) {

@Override public WebDriver context(String name) {
checkNotNull(name, "Must supply a context name");
execute(DriverCommand.SWITCH_TO_CONTEXT, ImmutableMap.of("name", name));
return this;
try {
execute(DriverCommand.SWITCH_TO_CONTEXT, ImmutableMap.of("name", name));
return this;
}
catch (WebDriverException e) {
throw new NoSuchContextException(e.getMessage(), e);
}
}

@Override public Set<String> getContextHandles() {
Expand Down
Expand Up @@ -20,7 +20,6 @@

import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import io.appium.java_client.HasSessionDetails;
import org.openqa.selenium.WebDriverException;
Expand All @@ -30,7 +29,6 @@

import java.lang.reflect.Constructor;
import java.util.Collection;
import java.util.Map;

/**
* Reconstitutes {@link org.openqa.selenium.WebElement}s from their JSON representation. Will recursively convert Lists
Expand Down Expand Up @@ -63,16 +61,13 @@ public Object apply(Object result) {
return Lists.newArrayList(Iterables.transform(results, this));
}

if (result instanceof Map<?, ?>) {
Map<?, ?> resultAsMap = (Map<?, ?>) result;
if (resultAsMap.containsKey("ELEMENT")) {
RemoteWebElement element = newMobileElement();
element.setId(String.valueOf(resultAsMap.get("ELEMENT")));
element.setFileDetector(driver.getFileDetector());
return element;
} else {
return Maps.transformValues(resultAsMap, this);
}
if (result instanceof RemoteWebElement) {
RemoteWebElement resultElement = RemoteWebElement.class.cast(result);
RemoteWebElement element = newMobileElement();
element.setParent(driver);
element.setId(resultElement.getId());
element.setFileDetector(driver.getFileDetector());
return element;
}

if (result instanceof Number) {
Expand Down

0 comments on commit 6eb0053

Please sign in to comment.