0

I am on Ubuntu. Chrome seems to open for a second and then crashes. So, I basically see a flash of chrome and then I get this message in the console:

"org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: crashed. (chrome not reachable) (The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'"

This is how I have it set up

WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox"); 
options.addArguments("--disable-dev-shm-usage"); 
driver = new ChromeDriver(options);

This is the class that I am running:

package com.noorteck.qa.api;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

import com.noorteck.qa.pages.CommonElementPage;
import com.noorteck.qa.pages.JobTitlesPage;
import com.noorteck.qa.pages.LoginPage;
import com.noorteck.qa.pages.NavigateToPage;
import com.noorteck.qa.utils.CommonUI;
import com.noorteck.qa.utils.ReadPropertyData;

public class DBDemo extends CommonUI {

    public static void main(String[] args) throws SQLException, ClassNotFoundException {

        String url = "jdbc:mysql://localhost:3306";
        String userName = "root";
        String password = "Negro434";
        String exStatus;
        String failedReason = "NULL";

        Class.forName("com.mysql.cj.jdbc.Driver");
        Connection con = DriverManager.getConnection(url, userName, password);

        Statement stm = con.createStatement();
        prop = ReadPropertyData.getProperties(configFilePath);

        openBrowser(prop.getProperty("browser"));
        navigate(prop.getProperty("url"));

        loginObj = new LoginPage();
        jobTitlesObj = new JobTitlesPage();
        navToPageObj = new NavigateToPage();
        commonElObj = new CommonElementPage();

        loginObj.login();
        navToPageObj.navigateToJobTitles();

        jobTitlesObj.clickAddIcon();
        jobTitlesObj.enterJobTitleName("Dev 0");
        jobTitlesObj.enterJobDescription("SDETTTTTT");
        commonElObj.clickSaveButton();

        String actualSuccessMessage = commonElObj.getSuccessMessage();
        String expectedSuccessMessage = "Successfully Saved";

        System.out.println(actualSuccessMessage);

        boolean outcome = actualSuccessMessage.equalsIgnoreCase(expectedSuccessMessage);

        if (outcome == true) {
            exStatus = "PASSED";
        } else {
            exStatus = "FAILED";
            failedReason = "[EXP:" + expectedSuccessMessage + "] -- [ACT: " + actualSuccessMessage + "]";
        }

        String query = "INSERT INTO walmart.testresults (project_name, sprint_number, us_number, region, status, failure_reason, date)"
                + "VALUES ('ntk', 404, 'ntk-404', 'scrum', '" + exStatus + "', '" + failedReason + "', '2021-04-11');";

        stm.executeUpdate(query);

        System.out.println(exStatus);
        System.out.println(query);
        apiSoftAssert.assertTrue(outcome);

    }

}

I have also played with different combinations of the options. Also installed chromium and it does the same thing, opens for a fraction of a second and closes.

options.addArguments("--no-sandbox"); 
//options.setBinary("/snap/bin/chromium");
//options.addArguments("--disable-dev-shm-usage"); 
//options.addArguments("--headless"); 

I run ./google-chrome from terminal and opens fine. Any ideas. Thank you

0 Answers0