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

IllegalArgumentException: object is not an instance of declaring class #491

Closed
robxu9 opened this issue Apr 5, 2017 · 10 comments
Closed
Assignees
Labels
Milestone

Comments

@robxu9
Copy link

robxu9 commented Apr 5, 2017

Trying to use either keyboard() or mouse() on an element results in the following stacktrace:

java.lang.IllegalArgumentException: object is not an instance of declaring class

	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:498)
	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.$Proxy38.getCoordinates(Unknown Source)
	at org.openqa.selenium.interactions.internal.MouseAction.getActionLocation(MouseAction.java:51)
	at org.openqa.selenium.interactions.internal.MouseAction.moveToLocation(MouseAction.java:58)
	at org.openqa.selenium.interactions.DoubleClickAction.perform(DoubleClickAction.java:39)
	at org.openqa.selenium.interactions.CompositeAction.perform(CompositeAction.java:50)
	at org.openqa.selenium.interactions.Actions.perform(Actions.java:373)
	at org.fluentlenium.core.action.MouseElementActions.doubleClick(MouseElementActions.java:109)
	at org.fluentlenium.core.domain.FluentWebElement.doubleClick(FluentWebElement.java:120)

...followed by wherever I called .mouse() or .keyboard() (or anything that uses it, like .doubleClick()).

It's causing me to be unable to double-click items.

I'm using Fluentlenium 3.1.1 with Chrome 57 and Selenium 3.0.1.

@filipcynarski filipcynarski added this to the 3.3 milestone Jul 25, 2017
@filipcynarski
Copy link
Member

@robxu9 let me test it on the newest versions of Selenium and FluentLenium and I'll check is it still a case.

@filipcynarski
Copy link
Member

I've retested it and seems to working fine @robxu9

@dominik1776
Copy link

dominik1776 commented Jun 22, 2018

Looks like there is still an issue indeed. Getting the same exception for env:

  • Google Chrome | 67.0.3396.62 (Official Build) (64-bit)
  • Selenium version 3.12.0
  • Fluentlenium version 3.5.2
    Is there any workaround for this?

java.lang.IllegalArgumentException: object is not an instance of declaring class 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:498) 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.$Proxy25.getCoordinates(Unknown Source) at org.openqa.selenium.interactions.internal.MouseAction.getActionLocation(MouseAction.java:65) at org.openqa.selenium.interactions.MoveMouseAction.perform(MoveMouseAction.java:43) at org.openqa.selenium.interactions.CompositeAction.perform(CompositeAction.java:36) at org.openqa.selenium.interactions.Actions$BuiltAction.perform(Actions.java:641) at org.openqa.selenium.interactions.Actions.perform(Actions.java:594) at org.fluentlenium.core.action.MouseElementActions.moveToElement(MouseElementActions.java:99) at com.TestP.moveMoseOverButton_aroundBody26(TestP.java:135) at com.TestP$AjcClosure27.run(TestP.java:1) at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149) at io.qameta.allure.aspects.StepsAspects.step(StepsAspects.java:51) at com.TestP.moveMoseOverButton(TestP.java:130) at com.MouseIsOverIt(Test.java:159) 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:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.fluentlenium.adapter.junit.FluentTestRule$1.evaluate(FluentTestRule.java:44) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.fluentlenium.adapter.junit.FluentTest$2$1.evaluate(FluentTest.java:55) at org.junit.rules.RunRules.evaluate(RunRules.java:20) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365) at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:272) at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:236) at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159) at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:386) at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:323) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:143)

@filipcynarski filipcynarski reopened this Jun 24, 2018
@filipcynarski filipcynarski modified the milestones: 3.3, 3.6 Jun 24, 2018
@filipcynarski filipcynarski self-assigned this Jun 24, 2018
@filipcynarski filipcynarski modified the milestones: 3.6, 3.7 Jun 27, 2018
@ouchxp
Copy link

ouchxp commented Jul 4, 2018

@dominik1776 Having the same issue here. My workaround is to call noHook() on the element or use @NoHook annotation. I assume the proxy object somehow is not properly generated.

@filipcynarski
Copy link
Member

@ouchxp @dominik1776 would you be able to provide the code which causing the issue?

@filipcynarski
Copy link
Member

I've got the description from @TomaszSzyborski

it is not important is the element defined by FindBy or el it fails w/ following exception

Throws exception:
elem.mouse().moveToElement();
java.lang.IllegalArgumentException: object is not an instance of declaring class                    

Passes:
elem.noHook().mouse().moveToElement();

@filipcynarski
Copy link
Member

Very interesting is a fact the test is passing for this part of code:

ActionOnSelectorAdvancedUserIntegrationTest#checkMouseOverAction

@filipcynarski
Copy link
Member

Ok, looks like @Wait annotation is causing the issue

this code won't work:

package org.fluentlenium.examples.quickstart;

import org.fluentlenium.adapter.junit.FluentTest;
import org.fluentlenium.core.hook.wait.Wait;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;

@Wait
public class DuckDuckGoTest extends FluentTest {
    @Test
    public void titleOfDuckDuckGoShouldContainSearchQueryName() {
        goTo("https://boardgamegeek.com/");
        el(".submenutabs .fl").mouse().moveToElement();
    }
}

this is working well

package org.fluentlenium.examples.quickstart;

import org.fluentlenium.adapter.junit.FluentTest;
import org.fluentlenium.core.hook.wait.Wait;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;

public class DuckDuckGoTest extends FluentTest {
    @Test
    public void titleOfDuckDuckGoShouldContainSearchQueryName() {
        goTo("https://boardgamegeek.com/");
        el(".submenutabs .fl").mouse().moveToElement();
    }
}

@koryl
Copy link
Collaborator

koryl commented Jul 6, 2018

This issue is related to #595.

filipcynarski added a commit that referenced this issue Jul 11, 2018
Issue reproduced and added to test
@filipcynarski
Copy link
Member

Issue resolved, code merged to develop

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

No branches or pull requests

5 participants