0

enter image description hereI am unable to launch browser where my test skips and no error is shown

public class BasePage{

public static WebDriver driver;

public void WebDriver initalizeDriver(String browserType){

try{
    switch(browserType){
       case "Chrome":
         System.out.println("selecting chrome");
         WebDriverManager.chromedriver.setup();
         driver = new ChromeDriver();
         break;
       case "Firefox":
         System.out.println("selecting firefox");
         WebDriverManager.firefoxdriver.setup();
         driver = new FirefoxDriver();
         break;
         }
         driver.manage.deleteAllCookies();
         driver.manage.window.maximize();
     }
         driver.get("https://www.spicejet.com")

   }catch(Exception e){
System.out.println("Error is =>"e.getMessage());
   }

return driver;

}

When I run the script it is working fine through TestNG.xml. But when i run through cmd line I didn't get any error, script prints Chrome but does not invoke or launch Chrome browser

I use following dependencies in pom.xml

<!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-surefire-plugin -->
<dependency>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0</version>
    <configuration>
        <includes>
           <include>testRunner.TestRunner</include>
        </includes>
    </configuration>
</dependency>
<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>5.3.2</version>
</dependency>
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.1.0</version>
    <scope>test</scope>
</dependency>

0 Answers0