Search code examples
eclipsetestngtest-suite

no such elemnts in second class testng


i need help i run code from xml file the first class called login it runs correctly but when it goes to setting class it fails that tells no such element

<suite name="myapp">
    <test name="first">
    <classes>
    <class name="cybertalents.loginclass"></class>
    <class name="cybertalents.Settingclass"></class>
    </classes>
    </test>
</suite>

public class suiteclass {
    WebDriver driver;

    @BeforeTest
    public void beforeSuite() {
        System.setProperty("webdriver.gecko.driver", "E:/Software Testing/Selenium/Programs/geckodriver.exe");
        driver = new FirefoxDriver();
        driver.get("http://52.211.167.71");
        driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
    }
    @AfterTest
    public void aftersuite() {
        driver.close();
    }

public class loginclass extends suiteclass {
    @Test
    public void loginpage() {
        loginpage login = new loginpage(driver);
        login.presslogin();
        login.sendkeys("", "");
        login.loginbutton();
        login.seetingpage();
    }
}

public class Settingclass extends suiteclass {
    @Test
    public void Method1()
    {
        setting st = new setting(driver);
        st.clear();
        st.sendkeys("", "", "", "]", "Software Testing",
                "", "", "");
        st.birthdate("25", "Jan", "2010");
        st.graduation("9", "Aug", "2015");
        st.selectfunction("f", "Angola", "Afghanistan", "Afghanistan", "Arabic");
    }
}

**test case of setting class related to login class i want to do it after finish login test case but it tells bo such element **


Solution

  • **Great i found the result ** the webdriver must be static