1
Hello, I am creating automated scripts using Selenium Webdriver and I am running within the Intellij IDE. I would like to know how it is possible to create a . JAR file from my scripts, so it would not be necessary to open the IDE and run the script.
I researched a lot and found no solution, the closest I got was that they said that it is necessary to have the class "main", but in my scripts there is no main class.
My scripts were created in the : src/test/java path
Below follows the very basic script, just to open the browser, as I can generate a . JAR of this script ?
import org.junit.Test;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import java.util.concurrent.TimeUnit;
public class AbrirNavegador {
private WebDriver navegador;
@Test
public void abrirNavegador() {
//Abrindo o navegador
System.setProperty("webdriver.chrome.driver", "C:\\Users\\Cesar\\Documents\\ChromeDriver\\chromedriver.exe");
WebDriver navegador = new ChromeDriver();
navegador.manage().window().maximize();
navegador.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
navegador.get("http://www.google.com");
}
}
You want to run the generated jar, or you want to use this jar in other tests?
– nullptr
Or you want to always run this test, regardless of the module in which it is?
– nullptr
I always want to run this test, is that I have several scripts that will never be changed, so they will always be executed the same way.
– César Augusto