Help me with an java.lang.IllegalArgumentException: Can not set io.appium.java_client.MobileElement field
@TikhomirovSergey is already working on this.
Since Nov 21, 2017.
- Dominant language
- Java
- Stars
- 1.3k
- Forks
- 752
- Avg merge
- 6d 21h
- Merged PRs (30d)
- 8
Description
The problem
I'm trying to run Testng Test. I get an error.
Environment
Appium version (or git revision) that exhibits the issue: 1.7.1
Last Appium version that did not exhibit the issue (if applicable):
Desktop OS/version used to run Appium: SierraMac
Node.js version (unless using Appium.app|exe):
Mobile platform/version under test: 7.0
Real device or emulator/simulator: Real
Appium CLI or Appium.app|exe: Appium
Link to Appium logs
I get no Logs
Code To Reproduce Issue [ Good To Have ]
public class AndroidTutorial_Page {
private AppiumDriver driver;
/*
- This is the title for the Tutorial screen
*/
// @AndroidFindBy( xpath = "//android.widget.TextView[@text='Enjoy Our Streamlined Design']" ) <--Production build xpath
@AndroidFindBy( xpath = "//android.widget.TextView[@text='Renew Eligible Annual Passes']" )
private MobileElement tutorial_Title1;
/*
- This is the Close Button at the top of the tutorial page for the PRODUCTION build
*/
@AndroidFindBy( id = "com.disney.mdx.wdw.google.debug:id/pulldown_image" )
private MobileElement tutorial_closeButton_Production;
/*
- This is the tutorial close button found on the DEBUG build
*/
@AndroidFindBy( id = "com.disney.mdx.wdw.google.debug:id/pulldown_image" )
private MobileElement tutorial_close;
/**
- Constructor
- @param driver
*/
public AndroidTutorial_Page(final AppiumDriver driver) {
this.driver = driver;
PageFactory.initElements(
new AppiumFieldDecorator(driver, AppiumConstants.IMPLICITLY_WAIT_TIMEOUT, TimeUnit.SECONDS), this);
}
/**
- verifyTutorialScreen
- @return true if Tutorial screen is displayed
*/
public boolean verifyTutorialScreen() throws TimeoutException {
System.out.println("Waiting for " + tutorial_Title1);
AutomationTools.waitForElementToLoad(driver, tutorial_Title1, 10);
Assert.assertEquals(true, tutorial_Title1.isDisplayed(), "Tutorial screen not found");
Log.log(driver).info("Verified Tutorial screen");
return true;
}
/**
- clickOnDismissScreen
- @return true if closed
*/
public boolean clickOnDismissScreen() throws TimeoutException {
AutomationTools.waitForElementToLoad(driver, tutorial_close, 10);
tutorial_close.click();
Log.log(driver).info("Clicked on Dismiss Tutorial");
return true;
}
==================================================
Console Logs:
[RemoteTestNG] detected TestNG version 6.13.0
FAILED: test
java.lang.IllegalArgumentException: Can not set io.appium.java_client.MobileElement field com.disney.appium.pageobjects.Android.Tutorial.AndroidTutorial_Page.tutorial_Title1 to org.openqa.selenium.remote.RemoteWebElement$$EnhancerByCGLIB$$dd998978
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
at java.lang.reflect.Field.set(Field.java:764)
at org.openqa.selenium.support.PageFactory.proxyFields(PageFactory.java:117)
at org.openqa.selenium.support.PageFactory.initElements(PageFactory.java:105)
at com.disney.appium.pageobjects.Android.Tutorial.AndroidTutorial_Page.(AndroidTutorial_Page.java:51)
at com.disney.appium.scripts.Android.TicketsPasses.AP_Renewal_Verify_that_eligible_expired_AP_Shows_on_Tickets_Passes_with_Renewal_CTA.test(AP_Renewal_Verify_that_eligible_expired_AP_Shows_on_Tickets_Passes_with_Renewal_CTA.java:29)
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.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:124)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:571)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:707)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:979)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
at org.testng.TestRunner.privateRun(TestRunner.java:648)
at org.testng.TestRunner.run(TestRunner.java:505)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:455)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:450)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:415)
at org.testng.SuiteRunner.run(SuiteRunner.java:364)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:84)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1187)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1116)
at org.testng.TestNG.runSuites(TestNG.java:1028)
at org.testng.TestNG.run(TestNG.java:996)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
===============================================
Default test
Tests run: 1, Failures: 1, Skips: 0
===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.