如何在硒中扩展课程?

时间:2016-08-12 03:52:43

标签: java selenium

我想在扩展类上使用一个函数,但我不能称之为

import testCase.mainClass;    
public class teamMemberValidation extends mainClass{

mainClass mClass = new mainClass;

@BeforeTest
public void beforeTest(){
    String exePath = "/home/dev/chromedriver";
    System.setProperty("webdriver.chrome.driver", exePath);
    driver = new ChromeDriver();
    driver.manage().window().maximize(); // Maximize window
    timeImp(5);
    driver.get("http://sample/sight");

    mClass.test("Hello World");
}

@AfterTest
public void afterTest() {
    //driver.close();
}   
}

public class mainClass {

@BeforeTest
public void beforeTest(){
    String exePath = "/home/dev/chromedriver";
    System.setProperty("webdriver.chrome.driver", exePath);
    driver = new ChromeDriver();
    driver.manage().window().maximize(); // Maximize window
    timeImp(5);
    driver.get("http://sample/sight");

    mClass.test("Hello World");
}

public void test(String text){
    System.out.print(text);
}

@AfterTest
public void afterTest() {
    //driver.close();
}   
}

0 个答案:

没有答案