How to use Appium AndroidDriver in Spring boot?











up vote
0
down vote

favorite












I am building an automation test tool using Vue as FE, Springboot as BE, Selenium and Appium as Test Framework. The main purpose is integrate web and android test in a single webapp.



The problem is, before I add Appium, everything related to web works just fine.
When I add appium dependency and try to create a Android Driver, the console keeps sending me errors like that:



java.lang.ClassNotFoundException: org.openqa.selenium.remote.BeanToJsonConverter


Here is the code of my controller:



@Autowired
private DriverService driverService;

@PostMapping("/start")
@ResponseBody
public List<ReportStep> start(@RequestBody Step steps) throws MalformedURLException {
WebDriver webDriver;
AndroidDriver<AndroidElement> androidDriver = null;
webDriver = new ChromeDriver();
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability("automationName", "Appium");
cap.setCapability("deviceName", "192.168.171.101:5555");
cap.setCapability("platformName", "Android");
cap.setCapability("platformVersion", "8.0");
cap.setCapability("appPackage", "com.tencent.mm");
cap.setCapability("appActivity", ".ui.LauncherUI");
cap.setCapability("unicodeKeyboard", "True");
cap.setCapability("resetKeyboard", "True");
cap.setCapability("noReset", "true");
cap.setCapability("newCommandTimeout", "60");
androidDriver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);

List<ReportStep> reportStepList = driverService.runSteps(webDriver,androidDriver,steps);
return reportStepList;
}


The console told me that



androidDriver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);


can't be initialized.



If I copy those code to a plain java project, it works well, so I guess it's something about spring framework and bean config.



Is there anyone can explain what is going on and how to fix it?










share|improve this question


























    up vote
    0
    down vote

    favorite












    I am building an automation test tool using Vue as FE, Springboot as BE, Selenium and Appium as Test Framework. The main purpose is integrate web and android test in a single webapp.



    The problem is, before I add Appium, everything related to web works just fine.
    When I add appium dependency and try to create a Android Driver, the console keeps sending me errors like that:



    java.lang.ClassNotFoundException: org.openqa.selenium.remote.BeanToJsonConverter


    Here is the code of my controller:



    @Autowired
    private DriverService driverService;

    @PostMapping("/start")
    @ResponseBody
    public List<ReportStep> start(@RequestBody Step steps) throws MalformedURLException {
    WebDriver webDriver;
    AndroidDriver<AndroidElement> androidDriver = null;
    webDriver = new ChromeDriver();
    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setCapability("automationName", "Appium");
    cap.setCapability("deviceName", "192.168.171.101:5555");
    cap.setCapability("platformName", "Android");
    cap.setCapability("platformVersion", "8.0");
    cap.setCapability("appPackage", "com.tencent.mm");
    cap.setCapability("appActivity", ".ui.LauncherUI");
    cap.setCapability("unicodeKeyboard", "True");
    cap.setCapability("resetKeyboard", "True");
    cap.setCapability("noReset", "true");
    cap.setCapability("newCommandTimeout", "60");
    androidDriver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);

    List<ReportStep> reportStepList = driverService.runSteps(webDriver,androidDriver,steps);
    return reportStepList;
    }


    The console told me that



    androidDriver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);


    can't be initialized.



    If I copy those code to a plain java project, it works well, so I guess it's something about spring framework and bean config.



    Is there anyone can explain what is going on and how to fix it?










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I am building an automation test tool using Vue as FE, Springboot as BE, Selenium and Appium as Test Framework. The main purpose is integrate web and android test in a single webapp.



      The problem is, before I add Appium, everything related to web works just fine.
      When I add appium dependency and try to create a Android Driver, the console keeps sending me errors like that:



      java.lang.ClassNotFoundException: org.openqa.selenium.remote.BeanToJsonConverter


      Here is the code of my controller:



      @Autowired
      private DriverService driverService;

      @PostMapping("/start")
      @ResponseBody
      public List<ReportStep> start(@RequestBody Step steps) throws MalformedURLException {
      WebDriver webDriver;
      AndroidDriver<AndroidElement> androidDriver = null;
      webDriver = new ChromeDriver();
      DesiredCapabilities cap = new DesiredCapabilities();
      cap.setCapability("automationName", "Appium");
      cap.setCapability("deviceName", "192.168.171.101:5555");
      cap.setCapability("platformName", "Android");
      cap.setCapability("platformVersion", "8.0");
      cap.setCapability("appPackage", "com.tencent.mm");
      cap.setCapability("appActivity", ".ui.LauncherUI");
      cap.setCapability("unicodeKeyboard", "True");
      cap.setCapability("resetKeyboard", "True");
      cap.setCapability("noReset", "true");
      cap.setCapability("newCommandTimeout", "60");
      androidDriver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);

      List<ReportStep> reportStepList = driverService.runSteps(webDriver,androidDriver,steps);
      return reportStepList;
      }


      The console told me that



      androidDriver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);


      can't be initialized.



      If I copy those code to a plain java project, it works well, so I guess it's something about spring framework and bean config.



      Is there anyone can explain what is going on and how to fix it?










      share|improve this question













      I am building an automation test tool using Vue as FE, Springboot as BE, Selenium and Appium as Test Framework. The main purpose is integrate web and android test in a single webapp.



      The problem is, before I add Appium, everything related to web works just fine.
      When I add appium dependency and try to create a Android Driver, the console keeps sending me errors like that:



      java.lang.ClassNotFoundException: org.openqa.selenium.remote.BeanToJsonConverter


      Here is the code of my controller:



      @Autowired
      private DriverService driverService;

      @PostMapping("/start")
      @ResponseBody
      public List<ReportStep> start(@RequestBody Step steps) throws MalformedURLException {
      WebDriver webDriver;
      AndroidDriver<AndroidElement> androidDriver = null;
      webDriver = new ChromeDriver();
      DesiredCapabilities cap = new DesiredCapabilities();
      cap.setCapability("automationName", "Appium");
      cap.setCapability("deviceName", "192.168.171.101:5555");
      cap.setCapability("platformName", "Android");
      cap.setCapability("platformVersion", "8.0");
      cap.setCapability("appPackage", "com.tencent.mm");
      cap.setCapability("appActivity", ".ui.LauncherUI");
      cap.setCapability("unicodeKeyboard", "True");
      cap.setCapability("resetKeyboard", "True");
      cap.setCapability("noReset", "true");
      cap.setCapability("newCommandTimeout", "60");
      androidDriver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);

      List<ReportStep> reportStepList = driverService.runSteps(webDriver,androidDriver,steps);
      return reportStepList;
      }


      The console told me that



      androidDriver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), cap);


      can't be initialized.



      If I copy those code to a plain java project, it works well, so I guess it's something about spring framework and bean config.



      Is there anyone can explain what is going on and how to fix it?







      android spring selenium spring-boot appium






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 5 hours ago









      Daniel Dai

      84




      84





























          active

          oldest

          votes











          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',
          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%2f53370914%2fhow-to-use-appium-androiddriver-in-spring-boot%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53370914%2fhow-to-use-appium-androiddriver-in-spring-boot%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

          Wiesbaden

          Marschland

          Dieringhausen