Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#696 FIX #699

Merged
merged 3 commits into from Aug 24, 2017
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions build.gradle
@@ -1,4 +1,5 @@
apply plugin: 'java'
apply plugin: 'idea'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
Expand Down Expand Up @@ -54,17 +55,17 @@ compileJava {
}

dependencies {
compile('org.seleniumhq.selenium:selenium-java:3.4.0'){
compile('org.seleniumhq.selenium:selenium-java:3.5.1'){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be nice to know whether it is possible to limit the update of major component version, so it would be possible to avoid similar compilation issues in the future. I'm thinking about the same logic, like in package.json for Node JS modules, where one can say "bla: ^1.0" and this will block the component "bla" from major version update (however, minor version updates are allowed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mykola-mokhnach Ok I will google how the similar problems are resolved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TikhomirovSergey @mykola-mokhnach i think it only restricts selenium-java dependency and not its sub modules or transitive dependency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TikhomirovSergey We are good to update to 3.5.2 as 3.5.+. I don't see any issues on yesterday's selenium release.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've almost created the same. Although having Selenium version assigned to a single variable looks more elegant to me ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or even shorter:

ext.seleniumVersion = '3.4.+'

dependencies {
    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
    }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome Looks good 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mykola-mokhnach @SrinivasanTarget Hi guys. Thank you for the discussion and advices. Today I am going to update the PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
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