I try to make me testing code more readable, but I have some problems with the availability of my driver. I will show you the code:
Here I implement my firefox webdriver:
package journey.setup;
import org.junit.Before;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class driver
{
public WebDriver driver;
@Before
public void driver()
{
System.setProperty("webdriver.gecko.driver",
"C:\\...\\geckodriver-v0.23.0-win64\\geckodriver.exe");
driver = new FirefoxDriver();
}
}
Next I wrote a class that make a class to get the url and is more readable:
package journey.actions;
import journey.setup.driver;
public class go extends driver
{
public static void to (String url)
{
driver driver = new driver();
driver.driver.get(url);
}
}
After that I have the readable method "go.to" in my test. But it doesn't work :(
public class login
{
@Given("^You visit: \"([^\"]*)\"$")
public void youVisit(String url) throws Throwable
{
go.to(url);
}
}
Have you an idea?
Aucun commentaire:
Enregistrer un commentaire