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

Getting AbstractMethodError in org.fluentlenium.core.events.EventAdapter.beforeChangeValueOf #457

Closed
zilkey opened this issue Dec 20, 2016 · 13 comments

Comments

@zilkey
Copy link

zilkey commented Dec 20, 2016

I can't get Fluentlenium to work with an app that uses Spring Boot.

(Please forgive me if this is not the correct place to submit this bug/question, but since the exception is being thrown from FluentLenium I thought I'd start here).

Steps to reproduce

  • Download an app from http://start.spring.io/ that includes "Web"
  • Follow instructions on the README in FluentLenium
  • Add the DuckDuckGo test (but fix windows to window)
  • Run mvn clean test

I've pushed an app with this bug here:

https://github.com/zilkey/spring-fluentlenium-abstract-method-example

Expected behavior

I expected the test to pass.

Actual Behavior

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 20.608 sec <<< FAILURE! - in com.example.DuckDuckGoTest
title_of_duck_duck_go_should_contain_search_query_name(com.example.DuckDuckGoTest)  Time elapsed: 20.589 sec  <<< ERROR!
java.lang.AbstractMethodError: org.fluentlenium.core.events.EventAdapter.beforeChangeValueOf(Lorg/openqa/selenium/WebElement;Lorg/openqa/selenium/WebDriver;)V
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.openqa.selenium.support.events.EventFiringWebDriver$1.invoke(EventFiringWebDriver.java:80)
	at com.sun.proxy.$Proxy27.beforeChangeValueOf(Unknown Source)
	at org.openqa.selenium.support.events.EventFiringWebDriver$EventFiringWebElement.clear(EventFiringWebDriver.java:363)
	at org.fluentlenium.core.hook.BaseHook.clear(BaseHook.java:37)
	at org.fluentlenium.core.hook.wait.WaitHook.clear(WaitHook.java:63)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.fluentlenium.core.proxy.AbstractLocatorHandler.invoke(AbstractLocatorHandler.java:294)
	at org.fluentlenium.core.proxy.AbstractLocatorHandler.invokeWithRetry(AbstractLocatorHandler.java:280)
	at org.fluentlenium.core.proxy.AbstractLocatorHandler.invoke(AbstractLocatorHandler.java:272)
	at org.fluentlenium.core.proxy.ComponentHandler.invoke(ComponentHandler.java:98)
	at com.sun.proxy.$Proxy31.clear(Unknown Source)
	at org.fluentlenium.core.domain.FluentWebElement.clear(FluentWebElement.java:225)
	at org.fluentlenium.core.domain.FluentWebElement.write(FluentWebElement.java:247)
	at org.fluentlenium.core.domain.FluentListImpl.write(FluentListImpl.java:306)
	at org.fluentlenium.core.action.Fill.with(Fill.java:38)
	at com.example.DuckDuckGoTest.title_of_duck_duck_go_should_contain_search_query_name(DuckDuckGoTest.java:14)


Results :

Tests in error: 
  DuckDuckGoTest.title_of_duck_duck_go_should_contain_search_query_name:14 » AbstractMethod

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0

And the (very long) output is here

When I debug I see that org.fluentlenium.core.events.EventAdapter is being fired, but beforeChangeValueOf is never called.

Any pointers on where to look next?

Other things I've tried

  • I've dowloaded the examples, and they work
  • I've also tried with chrome-driver

Since this seems like a dependency issue I tried to isolate the dependencies that are causing the error. It appears to be spring-boot-starter-parent that's causing the conflict, as this minimal pom.xml file will reproduce the error:

<?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>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>1.7.22</version>
        </dependency>

        <dependency>
            <groupId>org.fluentlenium</groupId>
            <artifactId>fluentlenium-junit</artifactId>
            <version>3.1.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.fluentlenium</groupId>
            <artifactId>fluentlenium-assertj</artifactId>
            <version>3.1.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>htmlunit-driver</artifactId>
            <version>2.23</version>
            <scope>test</scope>
        </dependency>
        <!-- jetty websocket is currently required by htmlunit-driver -->
        <dependency>
            <groupId>org.eclipse.jetty.websocket</groupId>
            <artifactId>websocket-api</artifactId>
            <version>9.3.5.v20151012</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.websocket</groupId>
            <artifactId>websocket-client</artifactId>
            <version>9.3.5.v20151012</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
            <scope>test</scope>
        </dependency>
    </dependencies>


</project>

Any thoughts or pointers?

@Toilal
Copy link
Member

Toilal commented Dec 20, 2016

Can you paste the output of mvn dependency:tree ? It seems the project is linked against Selenium 2 instead of Selenium 3.

@zilkey
Copy link
Author

zilkey commented Dec 20, 2016

That appears to be true:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-dependency-plugin:2.10:tree (default-cli) @ demo ---
[INFO] com.example:demo:jar:0.0.1-SNAPSHOT
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.22:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] +- org.fluentlenium:fluentlenium-junit:jar:3.1.0:test
[INFO] |  \- org.fluentlenium:fluentlenium-core:jar:3.1.0:test
[INFO] |     +- org.seleniumhq.selenium:selenium-api:jar:2.53.1:test
[INFO] |     |  +- com.google.guava:guava:jar:19.0:test
[INFO] |     |  \- com.google.code.gson:gson:jar:2.7:test
[INFO] |     +- org.seleniumhq.selenium:selenium-remote-driver:jar:2.53.1:test
[INFO] |     |  +- cglib:cglib-nodep:jar:2.1_3:test
[INFO] |     |  +- org.apache.commons:commons-exec:jar:1.3:test
[INFO] |     |  +- net.java.dev.jna:jna:jar:4.2.2:test
[INFO] |     |  \- net.java.dev.jna:jna-platform:jar:4.1.0:test
[INFO] |     +- org.atteo.classindex:classindex:jar:3.4:test
[INFO] |     +- commons-io:commons-io:jar:2.5:test
[INFO] |     \- org.apache.commons:commons-lang3:jar:3.4:test
[INFO] +- org.fluentlenium:fluentlenium-assertj:jar:3.1.0:test
[INFO] |  \- org.assertj:assertj-core:jar:2.5.0:test
[INFO] +- junit:junit:jar:4.12:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.seleniumhq.selenium:htmlunit-driver:jar:2.23:test
[INFO] |  +- org.seleniumhq.selenium:selenium-support:jar:2.53.1:test
[INFO] |  \- net.sourceforge.htmlunit:htmlunit:jar:2.21:test
[INFO] |     +- xalan:xalan:jar:2.7.2:test
[INFO] |     |  \- xalan:serializer:jar:2.7.2:test
[INFO] |     +- org.apache.httpcomponents:httpclient:jar:4.5.2:test
[INFO] |     |  \- org.apache.httpcomponents:httpcore:jar:4.4.5:test
[INFO] |     +- org.apache.httpcomponents:httpmime:jar:4.5.2:test
[INFO] |     +- commons-codec:commons-codec:jar:1.10:test
[INFO] |     +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.17:test
[INFO] |     +- net.sourceforge.htmlunit:neko-htmlunit:jar:2.21:test
[INFO] |     |  \- xerces:xercesImpl:jar:2.11.0:test
[INFO] |     \- net.sourceforge.cssparser:cssparser:jar:0.9.18:test
[INFO] |        \- org.w3c.css:sac:jar:1.3:test
[INFO] +- org.eclipse.jetty.websocket:websocket-api:jar:9.3.5.v20151012:test
[INFO] +- org.eclipse.jetty.websocket:websocket-client:jar:9.3.5.v20151012:test
[INFO] |  +- org.eclipse.jetty:jetty-util:jar:9.3.14.v20161028:test
[INFO] |  +- org.eclipse.jetty:jetty-io:jar:9.3.14.v20161028:test
[INFO] |  \- org.eclipse.jetty.websocket:websocket-common:jar:9.3.5.v20151012:test
[INFO] \- xml-apis:xml-apis:jar:1.4.01:test
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.086 s
[INFO] Finished at: 2016-12-20T13:07:16-07:00
[INFO] Final Memory: 16M/322M
[INFO] ------------------------------------------------------------------------

Looks like it's 2.53.1

@Toilal
Copy link
Member

Toilal commented Dec 20, 2016

It seems something's gone wrong with 3.1.0 release :( it's a bug.

@Toilal
Copy link
Member

Toilal commented Dec 20, 2016

I can't understand why it's resolved to 2.53.1 ... pom of fluentlenium-parent declares selenium.version to 3.0.0 ...

@zilkey
Copy link
Author

zilkey commented Dec 20, 2016

When I remove the Spring Boot Parent, it pulls in the correct version of selenium.

So when I remove:

 <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

Then I get this:

[INFO] com.example:demo:jar:0.0.1-SNAPSHOT
[INFO] +- org.fluentlenium:fluentlenium-junit:jar:3.1.0:test
[INFO] |  \- org.fluentlenium:fluentlenium-core:jar:3.1.0:test
[INFO] |     +- org.seleniumhq.selenium:selenium-api:jar:3.0.0:test
[INFO] |     +- org.seleniumhq.selenium:selenium-remote-driver:jar:3.0.0:test
[INFO] |     |  \- cglib:cglib-nodep:jar:3.2.4:test
[INFO] |     +- org.atteo.classindex:classindex:jar:3.4:test
[INFO] |     +- commons-io:commons-io:jar:2.5:test
[INFO] |     \- org.apache.commons:commons-lang3:jar:3.4:test
[INFO] +- org.fluentlenium:fluentlenium-assertj:jar:3.1.0:test
[INFO] |  \- org.assertj:assertj-core:jar:2.5.0:test
[INFO] +- junit:junit:jar:4.12:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.seleniumhq.selenium:htmlunit-driver:jar:2.23:test
[INFO] |  +- org.seleniumhq.selenium:selenium-support:jar:3.0.0-beta2:test
[INFO] |  |  +- org.apache.commons:commons-exec:jar:1.3:test
[INFO] |  |  +- com.google.code.gson:gson:jar:2.3.1:test
[INFO] |  |  +- com.google.guava:guava:jar:19.0:test
[INFO] |  |  +- org.hamcrest:hamcrest-all:jar:1.3:test
[INFO] |  |  +- net.java.dev.jna:jna:jar:4.1.0:test
[INFO] |  |  \- net.java.dev.jna:jna-platform:jar:4.1.0:test
[INFO] |  \- net.sourceforge.htmlunit:htmlunit:jar:2.23:test
[INFO] |     +- xalan:xalan:jar:2.7.2:test
[INFO] |     |  \- xalan:serializer:jar:2.7.2:test
[INFO] |     +- org.apache.httpcomponents:httpclient:jar:4.5.2:test
[INFO] |     |  \- org.apache.httpcomponents:httpcore:jar:4.4.4:test
[INFO] |     +- org.apache.httpcomponents:httpmime:jar:4.5.2:test
[INFO] |     +- commons-codec:commons-codec:jar:1.10:test
[INFO] |     +- net.sourceforge.htmlunit:htmlunit-core-js:jar:2.23:test
[INFO] |     +- net.sourceforge.htmlunit:neko-htmlunit:jar:2.23:test
[INFO] |     |  \- xerces:xercesImpl:jar:2.11.0:test
[INFO] |     +- net.sourceforge.cssparser:cssparser:jar:0.9.20:test
[INFO] |     |  \- org.w3c.css:sac:jar:1.3:test
[INFO] |     \- commons-logging:commons-logging:jar:1.2:test
[INFO] +- org.eclipse.jetty.websocket:websocket-api:jar:9.3.5.v20151012:test
[INFO] +- org.eclipse.jetty.websocket:websocket-client:jar:9.3.5.v20151012:test
[INFO] |  +- org.eclipse.jetty:jetty-util:jar:9.3.5.v20151012:test
[INFO] |  +- org.eclipse.jetty:jetty-io:jar:9.3.5.v20151012:test
[INFO] |  \- org.eclipse.jetty.websocket:websocket-common:jar:9.3.5.v20151012:test
[INFO] \- xml-apis:xml-apis:jar:1.4.01:test

@filipcynarski
Copy link
Member

I've fixed your code and it is passing now. It is an issue related to pom.xml

@Toilal
Copy link
Member

Toilal commented Dec 20, 2016

Spring boot parent pom declares a selenium.version property to 2.53.1, like the one defined in fluentlenium parent pom.

To solve this conflict you have to add the property to the effective selenium version to use in fluentlenium : 3.0.1.

<properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <selenium.version>3.0.1</selenium.version>
    </properties>

But there's another issue with htmlunit driver then ...

@filipcynarski
Copy link
Member

filipcynarski commented Dec 20, 2016

or remove parent reference from pom and set dependencies to:

    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <!--<parent>-->
        <!--<groupId>org.springframework.boot</groupId>-->
        <!--<artifactId>spring-boot-starter-parent</artifactId>-->
        <!--<version>1.4.2.RELEASE</version>-->
        <!--<relativePath/> &lt;!&ndash; lookup parent from repository &ndash;&gt;-->
    <!--</parent>-->

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>LATEST</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <version>LATEST</version>
        </dependency>

@filipcynarski
Copy link
Member

@zilkey is it anything we can help you in terms of reported issue or we can close this one?

@zilkey
Copy link
Author

zilkey commented Dec 20, 2016

You can close this. Thank you for the quick response! I'm still trying to figure out how to keep the spring boot parent and also get the right versions lined up, but this was super helpful. Thanks!

@filipcynarski
Copy link
Member

@zilkey thank you!

@zilkey
Copy link
Author

zilkey commented Dec 20, 2016

For future folks googling, here's a working pom.xml that includes the pom.xml generated by start.spring.io (with the parent) as well as a working selenium and HTMLUnit setup:

<?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>com.example</groupId>
    <artifactId>demo</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>demo</name>
    <description>Demo project for Spring Boot</description>

    <!-- Parent shipped with start.spring.io -->
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.4.2.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>

        <!-- I needed to add this -->
        <selenium.version>3.0.1</selenium.version>
    </properties>

    <dependencies>
        <!-- These shipped with start.spring.io -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <!-- These were copied from fluentlenium docs -->
        <dependency>
            <groupId>org.fluentlenium</groupId>
            <artifactId>fluentlenium-junit</artifactId>
            <version>3.1.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.fluentlenium</groupId>
            <artifactId>fluentlenium-assertj</artifactId>
            <version>3.1.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>htmlunit-driver</artifactId>
            <version>2.23.2</version>
            <scope>test</scope>
        </dependency>
        <!-- jetty websocket is currently required by htmlunit-driver -->
        <dependency>
            <groupId>org.eclipse.jetty.websocket</groupId>
            <artifactId>websocket-api</artifactId>
            <version>9.3.5.v20151012</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty.websocket</groupId>
            <artifactId>websocket-client</artifactId>
            <version>9.3.5.v20151012</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>1.4.01</version>
            <scope>test</scope>
        </dependency>

        <!-- I needed to add this -->
        <dependency>
            <groupId>net.sourceforge.htmlunit</groupId>
            <artifactId>htmlunit</artifactId>
            <version>2.23</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>


</project>

I just needed to add:

        <dependency>
            <groupId>net.sourceforge.htmlunit</groupId>
            <artifactId>htmlunit</artifactId>
            <version>2.23</version>
            <scope>test</scope>
        </dependency>

For those who encounter this in the future once the specific versions have changed, here was the process:

  • Ran the working example from fluentlenium's examples
  • Ran mvn dependency:tree > good.txt
  • Ran the test with the spring boot parent (and it failed)
  • Ran mvn dependency:tree > bad.txt
  • Did a diff of the dependencies
  • Added each one in from the good version one-by-one until I found the magic incantation

Thanks again @Toilal and @filipcynarski for the tips on how to fix this.

@agenteo
Copy link

agenteo commented Mar 3, 2017

I was getting the same error today.

The solution above didn't work for me. Instead I had to exclude selenium-support from fluentlenium-junit like this:

<dependency>
			<groupId>org.fluentlenium</groupId>
			<artifactId>fluentlenium-junit</artifactId>
			<version>3.1.1</version>
			<scope>test</scope>
			<exclusions>
				<exclusion>
					<artifactId>selenium-support</artifactId>
					<groupId>org.seleniumhq.selenium</groupId>
				</exclusion>
			</exclusions>
		</dependency>

and force it to:

		<dependency>
			<groupId>org.seleniumhq.selenium</groupId>
			<artifactId>selenium-support</artifactId>
			<version>3.0.1</version>
		</dependency>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants