appium/java-client

java-client's NewSessionPayload.class conflict with selenium's NewSessionPayload.class

Tenit2012 opened this issue · 12 comments

OS: Windows 10
Selenium Version: 3.9.1
Browser: Firefox
Browser Version: 59.0.2 (64-bit)

Expected Behavior

  • When start Firefox driver will call class NewSessionPageload.java of selenium instead call NewSessionPageload.java of java-client.

Actual Behavior

  • When start Firefox driver called class NewSessionPageload.java of java-client instead call NewSessionPageload.java of selenium.
  • Error message.
    Exception in thread "main" org.openqa.selenium.InvalidArgumentException: firefox_profile is not the name of a known capability or extension capability

Steps to reproduce

  • Please run source code to reproduce :

   public class FirefoxTest {
	public static void main(String[] args) {
         // declaration and instantiation of objects/variables
        System.setProperty("webdriver.gecko.driver", "/path/to/geckodriver_win64.exe");          
        FirefoxProfile ffprofile = new FirefoxProfile();
    	FirefoxOptions firefoxOptions = new FirefoxOptions();
    	firefoxOptions.setProfile(ffprofile);
	WebDriver driver = new FirefoxDriver(firefoxOptions);
        String baseUrl = "http://demo.guru99.com/test/newtours/";
        String expectedTitle = "Welcome: Mercury Tours";
        String actualTitle = "";
        driver.get(baseUrl);
        // get the actual value of the title
        actualTitle = driver.getTitle();
        /*
         * compare the actual title of the page with the expected one and print
         * the result as "Passed" or "Failed"
         */
        if (actualTitle.contentEquals(expectedTitle)){
            System.out.println("Test Passed!");
        } else {
            System.out.println("Test Failed");
        }     
        //close Fire fox
         driver.close();
           }
       }

------------------------------------------pom.xml file------------------------------------------------------

      <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>DemoFirefoxDriver</groupId>
<artifactId>DemoFirefoxDriver</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
	<selenium.webdriver.version>3.9.1</selenium.webdriver.version>
</properties>
<build>
	<plugins>
		<plugin>
			<!-- Build an executable JAR -->
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-jar-plugin</artifactId>
		</plugin>
	</plugins>
</build>
<dependencies>
	<dependency>
		<groupId>io.appium</groupId>
		<artifactId>java-client</artifactId>
		<version>6.0.0-BETA3</version>
	</dependency>
	<dependency>
		<groupId>org.seleniumhq.selenium</groupId>
		<artifactId>selenium-server</artifactId>
		<version>${selenium.webdriver.version}</version>
		<exclusions>
			<exclusion> <!-- declare the exclusion here -->
				<groupId>org.apache.httpcomponents</groupId>
				<artifactId>httpclient</artifactId>
			</exclusion>
			<exclusion>
				<groupId>xalan</groupId>
				<artifactId>xalan</artifactId>
			</exclusion>
		</exclusions>
	</dependency>
            <dependency>
		<groupId>org.seleniumhq.selenium</groupId>
		<artifactId>selenium-java</artifactId>
		<version>${selenium.webdriver.version}</version>
		<exclusions>
			<exclusion>
				<groupId>org.seleniumhq.selenium</groupId>
				<artifactId>selenium-firefox-driver</artifactId>
			</exclusion>
			<exclusion>
				<groupId>xalan</groupId>
				<artifactId>xalan</artifactId>
			</exclusion>
		</exclusions>
	</dependency>
	<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-firefox-driver -->
	<dependency>
		<groupId>org.seleniumhq.selenium</groupId>
		<artifactId>selenium-firefox-driver</artifactId>
		<version>${selenium.webdriver.version}</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-ie-driver -->
	<dependency>
		<groupId>org.seleniumhq.selenium</groupId>
		<artifactId>selenium-ie-driver</artifactId>
		<version>${selenium.webdriver.version}</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
	<dependency>
		<groupId>org.seleniumhq.selenium</groupId>
		<artifactId>selenium-chrome-driver</artifactId>
		<version>${selenium.webdriver.version}</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-edge-driver -->
	<dependency>
		<groupId>org.seleniumhq.selenium</groupId>
		<artifactId>selenium-edge-driver</artifactId>
		<version>${selenium.webdriver.version}</version>
	</dependency>

	<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-safari-driver -->
	<dependency>
		<groupId>org.seleniumhq.selenium</groupId>
		<artifactId>selenium-safari-driver</artifactId>
		<version>${selenium.webdriver.version}</version>
	</dependency>
	<dependency>
		<groupId>com.google.guava</groupId>
		<artifactId>guava</artifactId>
		<version>24.0-jre</version>
	</dependency>
</dependencies>

  • This is a bug of java-client?
  • Do Anyone have the workaround for this issue? Please advice me. Thank in advance!

Hi @SrinivasanTarget , @TikhomirovSergey ,
I have same this problem. Can you look into it?
Please let me know if you've any update/question. Thanks so much.

Anything works fine until the NewSessionPayload class is created in java-client at version 6.0.0-BETA3.

Here is a screenshot of java-client's NewSessionPayload class is called:
newsessionpayload collisions

@Trucnt
Hello! Could remove all dependencies on Selenium? I am suspecting the conflict of dependencies on selenium. I am seing that your project is depending on Selenium v3.9.1. Appium java client v6.0.0-BETA3 depends on 3.10. Also you can update your project to v6.0.0-BETA4

@Tenit2012 The reply above is for you too.

Hi @TikhomirovSergey
Perhaps you have misunderstood my problem.

My problem is when I run with Firefox driver, ProtocalHandShake.java class of library selenium called NewsessionPayload.java class of java-client library instead call NewsessionPayload.java class of selenium library.

I want to run with Firefox driver, ProtocalHandShake.java class will call NewsessionPayload.java of selenium library. Because both selenium and the Appium java-client contains org.openqa.selenium.remote.NewsessionPayload.java.

Did you reproduce on my issue?
Please read my issue carefully and let me know if you've any question/concern. Tks.

Is it indeed an Appium java client issue, @TikhomirovSergey ?

Guys. I am investigating

Guys @Trucnt @Tenit2012
I can't reproduce the problem.

The sample

The console ouput

image

It is normal now that NewsessionPayload from appium is used instead of the same class from selenium. It was the necessary step and we hope the situation will be changed. Also the appium lib has all dependencies from selenium.

Could you remove the dependency on selenium java and add such exclusion to selenium-server dependency? What the result?

Hey @TikhomirovSergey ,

As your suggestion, I have removed both selenium-java and selenium-server but this issue still happens.

To reproduce this problem, You must create FirefoxDriver with FirefoxOptions and FirefoxProfile is set into FirefoxOptions.

Further detail, please see screenshot below:

appium-java-client-issue

Please let me know if any update. Thanks in advance.

@Tenit2012 Ok. Trying to work it out. Thank you for details

Yes. I could reproduce this error. It seems something was broken because we did not test it on desktop browser.

The fix was merged. It is going to be published soon.