cannot figure out how to debug the error. i am using java 8,eclipse ,selenium 3 and writing testNG

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

cannot figure out how to debug the error. i am using java 8,eclipse ,selenium 3 and writing testNG

vinayak hurkadli
java-eclipse-testNG code is below

package testNG_tutorial;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.Assert;
import org.testng.annotations.Test;

public class myapplication {
System.setProperty("webdriver.gecko.driver","C:\\SeleniumGecko\\geckodriver.exe");
//System.setProperty("webdriver.gecko.driver","C:\\SeleniumGecko\\geckodriver.exe");
WebDriver driver=new FirefoxDriver();
@Test
public void startApp()
{
driver.get("https://enterprise-demo.orangehrmlive.com/auth/login");
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS );
String currentURL=driver.getCurrentUrl();
Assert.assertTrue(currentURL.contains("auth/login"));
}
@Test(dependsOnMethods="startApp")
public void loginApp()
{
driver.findElement(By.xpath(".//*[@id='divUsername']/span")).sendKeys("Admin");
driver.findElement(By.xpath(".//*[@id='divPassword']/span")).sendKeys("admin");
driver.findElement(By.xpath(".//*[@id='btnLogin']")).click();
boolean status=driver.findElement(By.xpath(".//*[@id='menu_admin_viewAdminModule']/b")).isDisplayed();
  Assert.assertTrue(status);
}
@Test(dependsOnMethods="loginApp")
public void logoutApp()
{
driver.findElement(By.xpath(".//*[@id='welcome']")).click();
driver.findElement(By.xpath("//a[text()='Logout']")).click();
Assert.assertTrue(driver.findElement(By.xpath(".//*[@id='txtUsername']")).isDisplayed());
}
}
===============================
the stracktrace for the above code is below
============================================
org.testng.TestNGException: 
Cannot instantiate class testNG_tutorial.myapplication
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:31)
at org.testng.internal.ClassHelper.createInstance1(ClassHelper.java:410)
at org.testng.internal.ClassHelper.createInstance(ClassHelper.java:323)
at org.testng.internal.ClassImpl.getDefaultInstance(ClassImpl.java:126)
at org.testng.internal.ClassImpl.getInstances(ClassImpl.java:191)
at org.testng.TestClass.getInstances(TestClass.java:99)
at org.testng.TestClass.initTestClassesAndInstances(TestClass.java:85)
at org.testng.TestClass.init(TestClass.java:77)
at org.testng.TestClass.<init>(TestClass.java:42)
at org.testng.TestRunner.initMethods(TestRunner.java:423)
at org.testng.TestRunner.init(TestRunner.java:250)
at org.testng.TestRunner.init(TestRunner.java:220)
at org.testng.TestRunner.<init>(TestRunner.java:169)
at org.testng.remote.support.RemoteTestNG6_10$1.newTestRunner(RemoteTestNG6_10.java:28)
at org.testng.remote.support.RemoteTestNG6_10$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG6_10.java:61)
at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:616)
at org.testng.SuiteRunner.init(SuiteRunner.java:185)
at org.testng.SuiteRunner.<init>(SuiteRunner.java:131)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1383)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1363)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1217)
at org.testng.TestNG.runSuites(TestNG.java:1144)
at org.testng.TestNG.run(TestNG.java:1115)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:132)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:230)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:76)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.testng.internal.ObjectFactoryImpl.newInstance(ObjectFactoryImpl.java:23)
... 25 more
Caused by: java.lang.Error: Unresolved compilation problems: 
Syntax error on token ".", @ expected after this token
Syntax error on token ",", < expected
Syntax error, insert "SimpleName" to complete QualifiedName
Syntax error, insert "Identifier (" to complete MethodHeaderName
Syntax error, insert ")" to complete MethodDeclaration

at testNG_tutorial.myapplication.<init>(myapplication.java:13)
... 30 more
=============================================================

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Loading...