This is the code I used to have to open its corresponding web driver by browser
.
@BeforeClass
@Parameters("browser")
public void openDriver(String browser) throws Exception {
driver = help.getRemoteDriver(help.GRID,browser);
.....
Just wondering is there any way to assign value to a variable in class? not in method? for example.
public class Test{
WebDriver driver;
@Parameters("browser")
public String browser = //"{browser}";
@Test
void test1(){
driver = help.getRemoteDriver(help.GRID,browser);
}
}
So I can call this String browser
variable without @Parameters
in the next new test. Even its child class.
Thank you in advance.