Appium: at org.testng.internal.ObjectFactoryImpl.newInstance
I'm trying to run the below code where the Appium server should start and the app should be installed in the emulator and perform some actions and close the app. But while running the below code getting the TestNG error. Can you please help me to resolve this issue?
Code:
package stepDefinitionFile;
+import java.io.File;
public class AppLaunch {
AndroidDriver driver= new AndroidDriver(setup(), Capabilities());
@BeforeSuite
public URL setup()
{
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("C:/Program Files/nodejs/node.exe"))
.withAppiumJS(new File("C:\Users\username\AppData\Local\Programs\Appium\resources\app\node_modules\appium\build\lib\main.js"))
.withIPAddress("0.0.0.0").usingPort(4723).withLogFile(new File("target/LogtoCheck+1.log")));
service.start();
URL URL = service.getUrl();
return URL;
}
@BeforeClass
public DesiredCapabilities Capabilities() {
File fd=new File("src");
File FDchild=new File(fd,"ApiDemos-debug.apk");
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Vinesh");
cap.setCapability(MobileCapabilityType.APP, FDchild.getAbsolutePath());
return Capabilities();
}
@Test
public void testFirst() {
System.out.println("test method is success");
allowAppPermission();
}
@AfterTest
public void End() {
driver.quit();
}
public void allowAppPermission(){
while (driver.findElements(MobileBy.xpath("//*[@class='android.widget.Button'][1]")).size()>0)
{
driver.findElement(MobileBy.xpath("//*[@class='android.widget.Button'][1]")).click();
}
}
}
**LOGS:**
[RemoteTestNG] detected TestNG version 6.14.2
[35m[Appium][39m Welcome to Appium v1.9.1
[35m[Appium][39m Non-default server args:
[35m[Appium][39m log: D:MasterCard_AtargetLogtoCheck+1.log
[35m[Appium][39m Appium REST http interface listener started on 0.0.0.0:4723
[35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m
[35m[HTTP][39m [90m{}[39m
[debug] [35m[GENERIC][39m Calling AppiumDriver.getStatus() with args:
[debug] [35m[GENERIC][39m Responding to client with driver.getStatus() result: {"build":{"version":"1.9.1"}}
[35m[HTTP][39m [37m<-- GET /wd/hub/status [39m[32m200[39m [90m9 ms - 67[39m
[35m[HTTP][39m [90m[39m
org.testng.TestNGException:
Cannot instantiate class stepDefinitionFile.AppLaunch
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:30)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:423)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:336)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:125)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:190)
at org.testng.TestClass.getInstances(TestClass.java:95)
at org.testng.TestClass.initTestClassesAndInstances(TestClass.java:81)
at org.testng.TestClass.init(TestClass.java:73)
at org.testng.TestClass.<init>(TestClass.java:38)
at org.testng.TestRunner.initMethods(TestRunner.java:389)
at org.testng.TestRunner.init(TestRunner.java:271)
at org.testng.TestRunner.init(TestRunner.java:241)
at org.testng.TestRunner.<init>(TestRunner.java:192)
appium-android
add a comment |
I'm trying to run the below code where the Appium server should start and the app should be installed in the emulator and perform some actions and close the app. But while running the below code getting the TestNG error. Can you please help me to resolve this issue?
Code:
package stepDefinitionFile;
+import java.io.File;
public class AppLaunch {
AndroidDriver driver= new AndroidDriver(setup(), Capabilities());
@BeforeSuite
public URL setup()
{
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("C:/Program Files/nodejs/node.exe"))
.withAppiumJS(new File("C:\Users\username\AppData\Local\Programs\Appium\resources\app\node_modules\appium\build\lib\main.js"))
.withIPAddress("0.0.0.0").usingPort(4723).withLogFile(new File("target/LogtoCheck+1.log")));
service.start();
URL URL = service.getUrl();
return URL;
}
@BeforeClass
public DesiredCapabilities Capabilities() {
File fd=new File("src");
File FDchild=new File(fd,"ApiDemos-debug.apk");
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Vinesh");
cap.setCapability(MobileCapabilityType.APP, FDchild.getAbsolutePath());
return Capabilities();
}
@Test
public void testFirst() {
System.out.println("test method is success");
allowAppPermission();
}
@AfterTest
public void End() {
driver.quit();
}
public void allowAppPermission(){
while (driver.findElements(MobileBy.xpath("//*[@class='android.widget.Button'][1]")).size()>0)
{
driver.findElement(MobileBy.xpath("//*[@class='android.widget.Button'][1]")).click();
}
}
}
**LOGS:**
[RemoteTestNG] detected TestNG version 6.14.2
[35m[Appium][39m Welcome to Appium v1.9.1
[35m[Appium][39m Non-default server args:
[35m[Appium][39m log: D:MasterCard_AtargetLogtoCheck+1.log
[35m[Appium][39m Appium REST http interface listener started on 0.0.0.0:4723
[35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m
[35m[HTTP][39m [90m{}[39m
[debug] [35m[GENERIC][39m Calling AppiumDriver.getStatus() with args:
[debug] [35m[GENERIC][39m Responding to client with driver.getStatus() result: {"build":{"version":"1.9.1"}}
[35m[HTTP][39m [37m<-- GET /wd/hub/status [39m[32m200[39m [90m9 ms - 67[39m
[35m[HTTP][39m [90m[39m
org.testng.TestNGException:
Cannot instantiate class stepDefinitionFile.AppLaunch
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:30)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:423)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:336)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:125)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:190)
at org.testng.TestClass.getInstances(TestClass.java:95)
at org.testng.TestClass.initTestClassesAndInstances(TestClass.java:81)
at org.testng.TestClass.init(TestClass.java:73)
at org.testng.TestClass.<init>(TestClass.java:38)
at org.testng.TestRunner.initMethods(TestRunner.java:389)
at org.testng.TestRunner.init(TestRunner.java:271)
at org.testng.TestRunner.init(TestRunner.java:241)
at org.testng.TestRunner.<init>(TestRunner.java:192)
appium-android
add a comment |
I'm trying to run the below code where the Appium server should start and the app should be installed in the emulator and perform some actions and close the app. But while running the below code getting the TestNG error. Can you please help me to resolve this issue?
Code:
package stepDefinitionFile;
+import java.io.File;
public class AppLaunch {
AndroidDriver driver= new AndroidDriver(setup(), Capabilities());
@BeforeSuite
public URL setup()
{
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("C:/Program Files/nodejs/node.exe"))
.withAppiumJS(new File("C:\Users\username\AppData\Local\Programs\Appium\resources\app\node_modules\appium\build\lib\main.js"))
.withIPAddress("0.0.0.0").usingPort(4723).withLogFile(new File("target/LogtoCheck+1.log")));
service.start();
URL URL = service.getUrl();
return URL;
}
@BeforeClass
public DesiredCapabilities Capabilities() {
File fd=new File("src");
File FDchild=new File(fd,"ApiDemos-debug.apk");
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Vinesh");
cap.setCapability(MobileCapabilityType.APP, FDchild.getAbsolutePath());
return Capabilities();
}
@Test
public void testFirst() {
System.out.println("test method is success");
allowAppPermission();
}
@AfterTest
public void End() {
driver.quit();
}
public void allowAppPermission(){
while (driver.findElements(MobileBy.xpath("//*[@class='android.widget.Button'][1]")).size()>0)
{
driver.findElement(MobileBy.xpath("//*[@class='android.widget.Button'][1]")).click();
}
}
}
**LOGS:**
[RemoteTestNG] detected TestNG version 6.14.2
[35m[Appium][39m Welcome to Appium v1.9.1
[35m[Appium][39m Non-default server args:
[35m[Appium][39m log: D:MasterCard_AtargetLogtoCheck+1.log
[35m[Appium][39m Appium REST http interface listener started on 0.0.0.0:4723
[35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m
[35m[HTTP][39m [90m{}[39m
[debug] [35m[GENERIC][39m Calling AppiumDriver.getStatus() with args:
[debug] [35m[GENERIC][39m Responding to client with driver.getStatus() result: {"build":{"version":"1.9.1"}}
[35m[HTTP][39m [37m<-- GET /wd/hub/status [39m[32m200[39m [90m9 ms - 67[39m
[35m[HTTP][39m [90m[39m
org.testng.TestNGException:
Cannot instantiate class stepDefinitionFile.AppLaunch
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:30)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:423)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:336)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:125)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:190)
at org.testng.TestClass.getInstances(TestClass.java:95)
at org.testng.TestClass.initTestClassesAndInstances(TestClass.java:81)
at org.testng.TestClass.init(TestClass.java:73)
at org.testng.TestClass.<init>(TestClass.java:38)
at org.testng.TestRunner.initMethods(TestRunner.java:389)
at org.testng.TestRunner.init(TestRunner.java:271)
at org.testng.TestRunner.init(TestRunner.java:241)
at org.testng.TestRunner.<init>(TestRunner.java:192)
appium-android
I'm trying to run the below code where the Appium server should start and the app should be installed in the emulator and perform some actions and close the app. But while running the below code getting the TestNG error. Can you please help me to resolve this issue?
Code:
package stepDefinitionFile;
+import java.io.File;
public class AppLaunch {
AndroidDriver driver= new AndroidDriver(setup(), Capabilities());
@BeforeSuite
public URL setup()
{
AppiumDriverLocalService service = AppiumDriverLocalService.buildService(new AppiumServiceBuilder()
.usingDriverExecutable(new File("C:/Program Files/nodejs/node.exe"))
.withAppiumJS(new File("C:\Users\username\AppData\Local\Programs\Appium\resources\app\node_modules\appium\build\lib\main.js"))
.withIPAddress("0.0.0.0").usingPort(4723).withLogFile(new File("target/LogtoCheck+1.log")));
service.start();
URL URL = service.getUrl();
return URL;
}
@BeforeClass
public DesiredCapabilities Capabilities() {
File fd=new File("src");
File FDchild=new File(fd,"ApiDemos-debug.apk");
DesiredCapabilities cap=new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Vinesh");
cap.setCapability(MobileCapabilityType.APP, FDchild.getAbsolutePath());
return Capabilities();
}
@Test
public void testFirst() {
System.out.println("test method is success");
allowAppPermission();
}
@AfterTest
public void End() {
driver.quit();
}
public void allowAppPermission(){
while (driver.findElements(MobileBy.xpath("//*[@class='android.widget.Button'][1]")).size()>0)
{
driver.findElement(MobileBy.xpath("//*[@class='android.widget.Button'][1]")).click();
}
}
}
**LOGS:**
[RemoteTestNG] detected TestNG version 6.14.2
[35m[Appium][39m Welcome to Appium v1.9.1
[35m[Appium][39m Non-default server args:
[35m[Appium][39m log: D:MasterCard_AtargetLogtoCheck+1.log
[35m[Appium][39m Appium REST http interface listener started on 0.0.0.0:4723
[35m[HTTP][39m [37m-->[39m [37mGET[39m [37m/wd/hub/status[39m
[35m[HTTP][39m [90m{}[39m
[debug] [35m[GENERIC][39m Calling AppiumDriver.getStatus() with args:
[debug] [35m[GENERIC][39m Responding to client with driver.getStatus() result: {"build":{"version":"1.9.1"}}
[35m[HTTP][39m [37m<-- GET /wd/hub/status [39m[32m200[39m [90m9 ms - 67[39m
[35m[HTTP][39m [90m[39m
org.testng.TestNGException:
Cannot instantiate class stepDefinitionFile.AppLaunch
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:30)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:423)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:336)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:125)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:190)
at org.testng.TestClass.getInstances(TestClass.java:95)
at org.testng.TestClass.initTestClassesAndInstances(TestClass.java:81)
at org.testng.TestClass.init(TestClass.java:73)
at org.testng.TestClass.<init>(TestClass.java:38)
at org.testng.TestRunner.initMethods(TestRunner.java:389)
at org.testng.TestRunner.init(TestRunner.java:271)
at org.testng.TestRunner.init(TestRunner.java:241)
at org.testng.TestRunner.<init>(TestRunner.java:192)
appium-android
appium-android
asked Nov 20 '18 at 8:13
VineshVinesh
62
62
add a comment |
add a comment |
0
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',
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
});
}
});
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%2f53388723%2fappium-at-org-testng-internal-objectfactoryimpl-newinstance%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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%2f53388723%2fappium-at-org-testng-internal-objectfactoryimpl-newinstance%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