- Getting the error "driver cannot be resolved" for running iam commenting out
- Unable to run the Testng suite.
How to fix the issue.
Baseurl.java
package MyTestNG;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class Baseurl
{
@Test
public static WebDriver basic()
{
WebDriver driver = new FirefoxDriver();
driver.manage().deleteAllCookies();
driver.get("http://www.sears.com/shc/s/CountryChooserView?storeId=10153&catalogId=12605");
return driver;
}
public static void Closebrowser()
{
driver.quit(); /// Iam getting this error, "**driver cannot be resolved**"
have done mistake i don't know
}
}
Countrychoser.java
package MyTestNG;
import org.testng.annotations.*;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import com.thoughtworks.selenium.Selenium;
import org.openqa.selenium.support.ui.Select;
import java.util.*;
import java.io.*;
public class Countrychoser
{
public static void Choser()
{
try
{
WebDriver driver = Baseurl.basic();
//driver.findElement(By.className("box_countryChooser")).click();
driver.findElement(By.id("intselect")).sendKeys("India");
driver.findElement(By.xpath(".//*[@id='countryChooser']/a/img")).click();
//window.onbeforeunload = null;
System.out.println("---------------------------------------");
System.out.println("Country choser layer test case-Success");
System.out.println("---------------------------------------");
}
catch(Exception e)
{
// Screenshot.pageScreenshot();
System.out.println(e);
System.out.println("---------------------------------------");
System.out.println("Country choser layer test case Failed");
System.out.println("---------------------------------------");
}
finally {
// Screenshot.pageScreenshot();
// Baseurl.Closebrowser();
}
}
}
and the XML Suite, below
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Suite1" allow-return-values="true">
<test name="First" >
<classes>
<class name="MyTestNG.Countrychoser" />
</classes>
</test>
</suite>
When iam running the TestNg suite getting the below error.
Method public static org.openqa.selenium.WebDriver MyTestNG.Baseurl.basic() has a @Test annotation but also a return value: ignoring it. Use <suite allow-return-values="true"> to fix this
[TestNG] Running:
C:\Users\Administrator\AppData\Local\Temp\testng-eclipse--1777632869\testng-customsuite.xml
===============================================
Default test
Tests run: 0, Failures: 0, Skips: 0
===============================================
===============================================
Default suite
Total tests run: 0, Failures: 0, Skips: 0
===============================================
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@13ad88b: 16 ms
[TestNG] Time taken by org.testng.reporters.XMLReporter@e0c07c: 31 ms
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 0 ms
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@9b1ac: 0 ms
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@182d86: 110 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@1548414: 93 ms
** can some one please help me for correcting the issue. **