Skip to content

Commit

Permalink
Merge pull request #699 from TikhomirovSergey/mykola-mokhnach-idea
Browse files Browse the repository at this point in the history
	#696 FIX
  • Loading branch information
TikhomirovSergey committed Aug 24, 2017
2 parents 76a1988 + 577b030 commit f96b165
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 21 deletions.
19 changes: 15 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
Expand All @@ -7,7 +8,7 @@ apply plugin: 'signing'
apply plugin: 'maven-publish'

group 'io.appium'
version '5.0.0-BETA9'
version '5.0.0'

repositories {
jcenter()
Expand Down Expand Up @@ -53,18 +54,28 @@ compileJava {
]
}

ext.seleniumVersion = '3.5.+'

dependencies {
compile('org.seleniumhq.selenium:selenium-java:3.4.0'){
compile ("org.seleniumhq.selenium:selenium-java:${seleniumVersion}") {
force = true

exclude module: 'cglib'
exclude group: 'com.google.code.gson'
}
compile ("org.seleniumhq.selenium:selenium-support:${seleniumVersion}") {
force = true
}
compile ("org.seleniumhq.selenium:selenium-api:${seleniumVersion}") {
force = true
}
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
8 changes: 6 additions & 2 deletions src/main/java/io/appium/java_client/AppiumDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,12 @@ 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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -96,20 +96,20 @@ protected By buildDefaultBy() {
By defaultBy = null;
FindBy findBy = annotatedElement.getAnnotation(FindBy.class);
if (findBy != null) {
defaultBy = super.buildByFromFindBy(findBy);
defaultBy = new FindBy.FindByBuilder().buildIt(findBy, (Field) annotatedElement);
}

if (defaultBy == null) {
FindBys findBys = annotatedElement.getAnnotation(FindBys.class);
if (findBys != null) {
defaultBy = super.buildByFromFindBys(findBys);
defaultBy = new FindBys.FindByBuilder().buildIt(findBys, (Field) annotatedElement);
}
}

if (defaultBy == null) {
FindAll findAll = annotatedElement.getAnnotation(FindAll.class);
if (findAll != null) {
defaultBy = super.buildBysFromFindByOneOf(findAll);
defaultBy = new FindAll.FindByBuilder().buildIt(findAll, (Field) annotatedElement);
}
}
return defaultBy;
Expand Down

0 comments on commit f96b165

Please sign in to comment.