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?
android spring selenium spring-boot appium
add a comment |
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?
android spring selenium spring-boot appium
add a comment |
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?
android spring selenium spring-boot appium
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
android spring selenium spring-boot appium
asked 5 hours ago
Daniel Dai
84
84
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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