com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to org.openqa.selenium.WebElement












1















I have the following code:



import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import java.net.URL;
import java.util.concurrent.TimeUnit;

public class SampleSauceCheckBoxTest {

public static final String URL = "http://127.0.0.1:4723/wd/hub";
public static AndroidDriver driver = null;

public static void main(String args) throws Exception {

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("app", "\Users\jsun\Downloads\app-debug.apk");

driver = new AndroidDriver<>(new URL(URL), capabilities);

/**
* Test Actions here...
*/
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

MobileElement mbeLogin = (MobileElement)driver.findElementByXPath("//android.widget.Button[@content-desc='Log In']");
mbeLogin.click();

//driver.quit();
}

}


Here is the output:




C:devjavajdk1.8.0_181binjava.exe "-javaagent:C:Program
FilesJetBrainsIntelliJ IDEA Community Edition
2018.2.4libidea_rt.jar=57587:C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2018.2.4bin" -Dfile.encoding=UTF-8 -classpath
C:devjavajdk1.8.0_181jrelibcharsets.jar;C:devjavajdk1.8.0_181jrelibdeploy.jar;C:devjavajdk1.8.0_181jrelibextaccess-bridge-64.jar;C:devjavajdk1.8.0_181jrelibextcldrdata.jar;C:devjavajdk1.8.0_181jrelibextdnsns.jar;C:devjavajdk1.8.0_181jrelibextjaccess.jar;C:devjavajdk1.8.0_181jrelibextjfxrt.jar;C:devjavajdk1.8.0_181jrelibextlocaledata.jar;C:devjavajdk1.8.0_181jrelibextnashorn.jar;C:devjavajdk1.8.0_181jrelibextsunec.jar;C:devjavajdk1.8.0_181jrelibextsunjce_provider.jar;C:devjavajdk1.8.0_181jrelibextsunmscapi.jar;C:devjavajdk1.8.0_181jrelibextsunpkcs11.jar;C:devjavajdk1.8.0_181jrelibextzipfs.jar;C:devjavajdk1.8.0_181jrelibjavaws.jar;C:devjavajdk1.8.0_181jrelibjce.jar;C:devjavajdk1.8.0_181jrelibjfr.jar;C:devjavajdk1.8.0_181jrelibjfxswt.jar;C:devjavajdk1.8.0_181jrelibjsse.jar;C:devjavajdk1.8.0_181jrelibmanagement-agent.jar;C:devjavajdk1.8.0_181jrelibplugin.jar;C:devjavajdk1.8.0_181jrelibresources.jar;C:devjavajdk1.8.0_181jrelibrt.jar;C:workSauceLabsTestoutproductionSauceLabsTest;C:workSauceLabsTestlibrefinedjava-client-3.4.0.jar;C:workSauceLabsTestlibrefinedselenium-server-standalone-3.4.0.jar
SampleSauceCheckBoxTest Nov 21, 2018 2:40:07 PM
org.openqa.selenium.remote.ProtocolHandshake createSession INFO:
Detected dialect: W3C Exception in thread "main"
org.openqa.selenium.WebDriverException: Returned value cannot be
converted to WebElement: {element-6066-11e4-a52e-4f735466cecf=1} Build
info: version: '3.4.0', revision: 'unknown', time: 'unknown' System
info: host: 'L5480X2M2S5M2', ip: '10.166.43.162', os.name: 'Windows
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: AndroidDriver at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:417)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:509)
at
io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:132)
at
io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at
io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1) at SampleSauceCheckBoxTest.main(SampleSauceCheckBoxTest.java:34)
Caused by: java.lang.ClassCastException:
com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to
org.openqa.selenium.WebElement at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:415)
... 5 more



Process finished with exit code 1




The code worked fine before, so that's not the problems about appium/selenium versions compatibility.










share|improve this question

























  • Put the error output into a quote block for readability

    – e_i_pi
    Nov 22 '18 at 0:24
















1















I have the following code:



import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import java.net.URL;
import java.util.concurrent.TimeUnit;

public class SampleSauceCheckBoxTest {

public static final String URL = "http://127.0.0.1:4723/wd/hub";
public static AndroidDriver driver = null;

public static void main(String args) throws Exception {

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("app", "\Users\jsun\Downloads\app-debug.apk");

driver = new AndroidDriver<>(new URL(URL), capabilities);

/**
* Test Actions here...
*/
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

MobileElement mbeLogin = (MobileElement)driver.findElementByXPath("//android.widget.Button[@content-desc='Log In']");
mbeLogin.click();

//driver.quit();
}

}


Here is the output:




C:devjavajdk1.8.0_181binjava.exe "-javaagent:C:Program
FilesJetBrainsIntelliJ IDEA Community Edition
2018.2.4libidea_rt.jar=57587:C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2018.2.4bin" -Dfile.encoding=UTF-8 -classpath
C:devjavajdk1.8.0_181jrelibcharsets.jar;C:devjavajdk1.8.0_181jrelibdeploy.jar;C:devjavajdk1.8.0_181jrelibextaccess-bridge-64.jar;C:devjavajdk1.8.0_181jrelibextcldrdata.jar;C:devjavajdk1.8.0_181jrelibextdnsns.jar;C:devjavajdk1.8.0_181jrelibextjaccess.jar;C:devjavajdk1.8.0_181jrelibextjfxrt.jar;C:devjavajdk1.8.0_181jrelibextlocaledata.jar;C:devjavajdk1.8.0_181jrelibextnashorn.jar;C:devjavajdk1.8.0_181jrelibextsunec.jar;C:devjavajdk1.8.0_181jrelibextsunjce_provider.jar;C:devjavajdk1.8.0_181jrelibextsunmscapi.jar;C:devjavajdk1.8.0_181jrelibextsunpkcs11.jar;C:devjavajdk1.8.0_181jrelibextzipfs.jar;C:devjavajdk1.8.0_181jrelibjavaws.jar;C:devjavajdk1.8.0_181jrelibjce.jar;C:devjavajdk1.8.0_181jrelibjfr.jar;C:devjavajdk1.8.0_181jrelibjfxswt.jar;C:devjavajdk1.8.0_181jrelibjsse.jar;C:devjavajdk1.8.0_181jrelibmanagement-agent.jar;C:devjavajdk1.8.0_181jrelibplugin.jar;C:devjavajdk1.8.0_181jrelibresources.jar;C:devjavajdk1.8.0_181jrelibrt.jar;C:workSauceLabsTestoutproductionSauceLabsTest;C:workSauceLabsTestlibrefinedjava-client-3.4.0.jar;C:workSauceLabsTestlibrefinedselenium-server-standalone-3.4.0.jar
SampleSauceCheckBoxTest Nov 21, 2018 2:40:07 PM
org.openqa.selenium.remote.ProtocolHandshake createSession INFO:
Detected dialect: W3C Exception in thread "main"
org.openqa.selenium.WebDriverException: Returned value cannot be
converted to WebElement: {element-6066-11e4-a52e-4f735466cecf=1} Build
info: version: '3.4.0', revision: 'unknown', time: 'unknown' System
info: host: 'L5480X2M2S5M2', ip: '10.166.43.162', os.name: 'Windows
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: AndroidDriver at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:417)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:509)
at
io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:132)
at
io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at
io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1) at SampleSauceCheckBoxTest.main(SampleSauceCheckBoxTest.java:34)
Caused by: java.lang.ClassCastException:
com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to
org.openqa.selenium.WebElement at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:415)
... 5 more



Process finished with exit code 1




The code worked fine before, so that's not the problems about appium/selenium versions compatibility.










share|improve this question

























  • Put the error output into a quote block for readability

    – e_i_pi
    Nov 22 '18 at 0:24














1












1








1








I have the following code:



import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import java.net.URL;
import java.util.concurrent.TimeUnit;

public class SampleSauceCheckBoxTest {

public static final String URL = "http://127.0.0.1:4723/wd/hub";
public static AndroidDriver driver = null;

public static void main(String args) throws Exception {

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("app", "\Users\jsun\Downloads\app-debug.apk");

driver = new AndroidDriver<>(new URL(URL), capabilities);

/**
* Test Actions here...
*/
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

MobileElement mbeLogin = (MobileElement)driver.findElementByXPath("//android.widget.Button[@content-desc='Log In']");
mbeLogin.click();

//driver.quit();
}

}


Here is the output:




C:devjavajdk1.8.0_181binjava.exe "-javaagent:C:Program
FilesJetBrainsIntelliJ IDEA Community Edition
2018.2.4libidea_rt.jar=57587:C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2018.2.4bin" -Dfile.encoding=UTF-8 -classpath
C:devjavajdk1.8.0_181jrelibcharsets.jar;C:devjavajdk1.8.0_181jrelibdeploy.jar;C:devjavajdk1.8.0_181jrelibextaccess-bridge-64.jar;C:devjavajdk1.8.0_181jrelibextcldrdata.jar;C:devjavajdk1.8.0_181jrelibextdnsns.jar;C:devjavajdk1.8.0_181jrelibextjaccess.jar;C:devjavajdk1.8.0_181jrelibextjfxrt.jar;C:devjavajdk1.8.0_181jrelibextlocaledata.jar;C:devjavajdk1.8.0_181jrelibextnashorn.jar;C:devjavajdk1.8.0_181jrelibextsunec.jar;C:devjavajdk1.8.0_181jrelibextsunjce_provider.jar;C:devjavajdk1.8.0_181jrelibextsunmscapi.jar;C:devjavajdk1.8.0_181jrelibextsunpkcs11.jar;C:devjavajdk1.8.0_181jrelibextzipfs.jar;C:devjavajdk1.8.0_181jrelibjavaws.jar;C:devjavajdk1.8.0_181jrelibjce.jar;C:devjavajdk1.8.0_181jrelibjfr.jar;C:devjavajdk1.8.0_181jrelibjfxswt.jar;C:devjavajdk1.8.0_181jrelibjsse.jar;C:devjavajdk1.8.0_181jrelibmanagement-agent.jar;C:devjavajdk1.8.0_181jrelibplugin.jar;C:devjavajdk1.8.0_181jrelibresources.jar;C:devjavajdk1.8.0_181jrelibrt.jar;C:workSauceLabsTestoutproductionSauceLabsTest;C:workSauceLabsTestlibrefinedjava-client-3.4.0.jar;C:workSauceLabsTestlibrefinedselenium-server-standalone-3.4.0.jar
SampleSauceCheckBoxTest Nov 21, 2018 2:40:07 PM
org.openqa.selenium.remote.ProtocolHandshake createSession INFO:
Detected dialect: W3C Exception in thread "main"
org.openqa.selenium.WebDriverException: Returned value cannot be
converted to WebElement: {element-6066-11e4-a52e-4f735466cecf=1} Build
info: version: '3.4.0', revision: 'unknown', time: 'unknown' System
info: host: 'L5480X2M2S5M2', ip: '10.166.43.162', os.name: 'Windows
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: AndroidDriver at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:417)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:509)
at
io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:132)
at
io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at
io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1) at SampleSauceCheckBoxTest.main(SampleSauceCheckBoxTest.java:34)
Caused by: java.lang.ClassCastException:
com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to
org.openqa.selenium.WebElement at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:415)
... 5 more



Process finished with exit code 1




The code worked fine before, so that's not the problems about appium/selenium versions compatibility.










share|improve this question
















I have the following code:



import io.appium.java_client.AppiumDriver;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchAction;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;
import io.appium.java_client.android.AndroidDriver;
import java.net.URL;
import java.util.concurrent.TimeUnit;

public class SampleSauceCheckBoxTest {

public static final String URL = "http://127.0.0.1:4723/wd/hub";
public static AndroidDriver driver = null;

public static void main(String args) throws Exception {

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("platformName", "Android");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("deviceName", "Android Emulator");
capabilities.setCapability("app", "\Users\jsun\Downloads\app-debug.apk");

driver = new AndroidDriver<>(new URL(URL), capabilities);

/**
* Test Actions here...
*/
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);

MobileElement mbeLogin = (MobileElement)driver.findElementByXPath("//android.widget.Button[@content-desc='Log In']");
mbeLogin.click();

//driver.quit();
}

}


Here is the output:




C:devjavajdk1.8.0_181binjava.exe "-javaagent:C:Program
FilesJetBrainsIntelliJ IDEA Community Edition
2018.2.4libidea_rt.jar=57587:C:Program FilesJetBrainsIntelliJ IDEA Community Edition 2018.2.4bin" -Dfile.encoding=UTF-8 -classpath
C:devjavajdk1.8.0_181jrelibcharsets.jar;C:devjavajdk1.8.0_181jrelibdeploy.jar;C:devjavajdk1.8.0_181jrelibextaccess-bridge-64.jar;C:devjavajdk1.8.0_181jrelibextcldrdata.jar;C:devjavajdk1.8.0_181jrelibextdnsns.jar;C:devjavajdk1.8.0_181jrelibextjaccess.jar;C:devjavajdk1.8.0_181jrelibextjfxrt.jar;C:devjavajdk1.8.0_181jrelibextlocaledata.jar;C:devjavajdk1.8.0_181jrelibextnashorn.jar;C:devjavajdk1.8.0_181jrelibextsunec.jar;C:devjavajdk1.8.0_181jrelibextsunjce_provider.jar;C:devjavajdk1.8.0_181jrelibextsunmscapi.jar;C:devjavajdk1.8.0_181jrelibextsunpkcs11.jar;C:devjavajdk1.8.0_181jrelibextzipfs.jar;C:devjavajdk1.8.0_181jrelibjavaws.jar;C:devjavajdk1.8.0_181jrelibjce.jar;C:devjavajdk1.8.0_181jrelibjfr.jar;C:devjavajdk1.8.0_181jrelibjfxswt.jar;C:devjavajdk1.8.0_181jrelibjsse.jar;C:devjavajdk1.8.0_181jrelibmanagement-agent.jar;C:devjavajdk1.8.0_181jrelibplugin.jar;C:devjavajdk1.8.0_181jrelibresources.jar;C:devjavajdk1.8.0_181jrelibrt.jar;C:workSauceLabsTestoutproductionSauceLabsTest;C:workSauceLabsTestlibrefinedjava-client-3.4.0.jar;C:workSauceLabsTestlibrefinedselenium-server-standalone-3.4.0.jar
SampleSauceCheckBoxTest Nov 21, 2018 2:40:07 PM
org.openqa.selenium.remote.ProtocolHandshake createSession INFO:
Detected dialect: W3C Exception in thread "main"
org.openqa.selenium.WebDriverException: Returned value cannot be
converted to WebElement: {element-6066-11e4-a52e-4f735466cecf=1} Build
info: version: '3.4.0', revision: 'unknown', time: 'unknown' System
info: host: 'L5480X2M2S5M2', ip: '10.166.43.162', os.name: 'Windows
10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: AndroidDriver at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:417)
at
org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:509)
at
io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:132)
at
io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
at
io.appium.java_client.android.AndroidDriver.findElementByXPath(AndroidDriver.java:1) at SampleSauceCheckBoxTest.main(SampleSauceCheckBoxTest.java:34)
Caused by: java.lang.ClassCastException:
com.google.common.collect.Maps$TransformedEntriesMap cannot be cast to
org.openqa.selenium.WebElement at
org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:415)
... 5 more



Process finished with exit code 1




The code worked fine before, so that's not the problems about appium/selenium versions compatibility.







appium appium-android






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 24 '18 at 12:48









Wasiq Bhamla

691159




691159










asked Nov 21 '18 at 20:46









Jeremy SunJeremy Sun

61




61













  • Put the error output into a quote block for readability

    – e_i_pi
    Nov 22 '18 at 0:24



















  • Put the error output into a quote block for readability

    – e_i_pi
    Nov 22 '18 at 0:24

















Put the error output into a quote block for readability

– e_i_pi
Nov 22 '18 at 0:24





Put the error output into a quote block for readability

– e_i_pi
Nov 22 '18 at 0:24












1 Answer
1






active

oldest

votes


















1














From the logs I can understand that you need to use generic AndroidDriver with type MobileElement. So in your code change the following line as,



AndroidDriver <MobileElement> driver = null;


Also remove casting to MobileElement done while finding the element.



Edit:
Also make sure to use latest Appium Java client and Selenium.






share|improve this answer


























  • It's not working. :(

    – Jeremy Sun
    Nov 23 '18 at 15:10











  • What version of Appium server, Java client and selenium are you using? Make sure you are using latest stable version of all.

    – Wasiq Bhamla
    Nov 23 '18 at 15:52











  • Selenium and Appium are both using 3.4. And Selenium Java is also using 3.4

    – Jeremy Sun
    Nov 23 '18 at 16:20











  • It works now. I changed the Selenium and Selenium Java versions to 3.14. And Appium to 6.1

    – Jeremy Sun
    Nov 23 '18 at 16:31











  • Thank you Wasiq!

    – Jeremy Sun
    Nov 23 '18 at 16:34











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420231%2fcom-google-common-collect-mapstransformedentriesmap-cannot-be-cast-to-org-openq%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














From the logs I can understand that you need to use generic AndroidDriver with type MobileElement. So in your code change the following line as,



AndroidDriver <MobileElement> driver = null;


Also remove casting to MobileElement done while finding the element.



Edit:
Also make sure to use latest Appium Java client and Selenium.






share|improve this answer


























  • It's not working. :(

    – Jeremy Sun
    Nov 23 '18 at 15:10











  • What version of Appium server, Java client and selenium are you using? Make sure you are using latest stable version of all.

    – Wasiq Bhamla
    Nov 23 '18 at 15:52











  • Selenium and Appium are both using 3.4. And Selenium Java is also using 3.4

    – Jeremy Sun
    Nov 23 '18 at 16:20











  • It works now. I changed the Selenium and Selenium Java versions to 3.14. And Appium to 6.1

    – Jeremy Sun
    Nov 23 '18 at 16:31











  • Thank you Wasiq!

    – Jeremy Sun
    Nov 23 '18 at 16:34
















1














From the logs I can understand that you need to use generic AndroidDriver with type MobileElement. So in your code change the following line as,



AndroidDriver <MobileElement> driver = null;


Also remove casting to MobileElement done while finding the element.



Edit:
Also make sure to use latest Appium Java client and Selenium.






share|improve this answer


























  • It's not working. :(

    – Jeremy Sun
    Nov 23 '18 at 15:10











  • What version of Appium server, Java client and selenium are you using? Make sure you are using latest stable version of all.

    – Wasiq Bhamla
    Nov 23 '18 at 15:52











  • Selenium and Appium are both using 3.4. And Selenium Java is also using 3.4

    – Jeremy Sun
    Nov 23 '18 at 16:20











  • It works now. I changed the Selenium and Selenium Java versions to 3.14. And Appium to 6.1

    – Jeremy Sun
    Nov 23 '18 at 16:31











  • Thank you Wasiq!

    – Jeremy Sun
    Nov 23 '18 at 16:34














1












1








1







From the logs I can understand that you need to use generic AndroidDriver with type MobileElement. So in your code change the following line as,



AndroidDriver <MobileElement> driver = null;


Also remove casting to MobileElement done while finding the element.



Edit:
Also make sure to use latest Appium Java client and Selenium.






share|improve this answer















From the logs I can understand that you need to use generic AndroidDriver with type MobileElement. So in your code change the following line as,



AndroidDriver <MobileElement> driver = null;


Also remove casting to MobileElement done while finding the element.



Edit:
Also make sure to use latest Appium Java client and Selenium.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 '18 at 16:47

























answered Nov 23 '18 at 6:30









Wasiq BhamlaWasiq Bhamla

691159




691159













  • It's not working. :(

    – Jeremy Sun
    Nov 23 '18 at 15:10











  • What version of Appium server, Java client and selenium are you using? Make sure you are using latest stable version of all.

    – Wasiq Bhamla
    Nov 23 '18 at 15:52











  • Selenium and Appium are both using 3.4. And Selenium Java is also using 3.4

    – Jeremy Sun
    Nov 23 '18 at 16:20











  • It works now. I changed the Selenium and Selenium Java versions to 3.14. And Appium to 6.1

    – Jeremy Sun
    Nov 23 '18 at 16:31











  • Thank you Wasiq!

    – Jeremy Sun
    Nov 23 '18 at 16:34



















  • It's not working. :(

    – Jeremy Sun
    Nov 23 '18 at 15:10











  • What version of Appium server, Java client and selenium are you using? Make sure you are using latest stable version of all.

    – Wasiq Bhamla
    Nov 23 '18 at 15:52











  • Selenium and Appium are both using 3.4. And Selenium Java is also using 3.4

    – Jeremy Sun
    Nov 23 '18 at 16:20











  • It works now. I changed the Selenium and Selenium Java versions to 3.14. And Appium to 6.1

    – Jeremy Sun
    Nov 23 '18 at 16:31











  • Thank you Wasiq!

    – Jeremy Sun
    Nov 23 '18 at 16:34

















It's not working. :(

– Jeremy Sun
Nov 23 '18 at 15:10





It's not working. :(

– Jeremy Sun
Nov 23 '18 at 15:10













What version of Appium server, Java client and selenium are you using? Make sure you are using latest stable version of all.

– Wasiq Bhamla
Nov 23 '18 at 15:52





What version of Appium server, Java client and selenium are you using? Make sure you are using latest stable version of all.

– Wasiq Bhamla
Nov 23 '18 at 15:52













Selenium and Appium are both using 3.4. And Selenium Java is also using 3.4

– Jeremy Sun
Nov 23 '18 at 16:20





Selenium and Appium are both using 3.4. And Selenium Java is also using 3.4

– Jeremy Sun
Nov 23 '18 at 16:20













It works now. I changed the Selenium and Selenium Java versions to 3.14. And Appium to 6.1

– Jeremy Sun
Nov 23 '18 at 16:31





It works now. I changed the Selenium and Selenium Java versions to 3.14. And Appium to 6.1

– Jeremy Sun
Nov 23 '18 at 16:31













Thank you Wasiq!

– Jeremy Sun
Nov 23 '18 at 16:34





Thank you Wasiq!

– Jeremy Sun
Nov 23 '18 at 16:34




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53420231%2fcom-google-common-collect-mapstransformedentriesmap-cannot-be-cast-to-org-openq%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith