Posted in Errors

org.openqa.selenium.SessionNotCreatedException: session not created: This version of ChromeDriver only supports Chrome version 92, Current browser version is 91.0.4472.77 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

Update your current Chromedriver.exe file to the latest current chrome browser version

If you are using WebDriverManager  in your project then go to MVN repository and try the latest WebDriverManager  mvn dependency

<!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
<dependency>
    <groupId>io.github.bonigarcia</groupId>
    <artifactId>webdrivermanager</artifactId>
    <version>3.8.1</version>
</dependency>

Posted in Errors

[Error] java.lang.NullPointerException at testutils.ExcelReader.getRowCount(ExcelReader.java:86) OR Nullpointer Exception While Using Trying to Read Excel in Selenium Running from Jenkins(Linux Server) OR Exception in thread “TestNG-test=SetUp-1” java.lang.NullPointerException




1)Ensure your excel file Path is correct
2) If you are running your Selenium scripts on windows machine use ("user.dir") + "\\src\\test\\resources\\testData\\simple.xlsx"
3) If you are running your Selenium scripts on Linux the folder structures just follow / 
("user.dir") + "/src/test/resources/testData/simple.xlsx"
Posted in Errors

java.lang.NullPointerException OR org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally. error: DevToolsActivePort file doesn’t exist) in Jenkins(Linux Server) Selenium

If you are running your selenium scripts on Jenkins Linux server without headless mode or with headless mode without setting all the chrome options you will face this error. Try below chrome options

WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addArguments("--window-size=1920,1080");
options.addArguments("--allow-insecure-localhost");
options.addArguments("--headless");
options.addArguments("--disable-gpu");
options.addArguments("--no-sandbox");
options.addArguments("--ignore-certificate-errors");
options.addArguments("--allow-running-insecure-content");
options.addArguments("--disable-setuid-sandbox");
options.addArguments("--disable-dev-shm-usage");
driver = new ChromeDriver(options);
DriverManager.setDriver(driver);
Posted in Errors

org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an error in the forked process OR testng.xml is not a valid file

1) If you are running your selenium scripts through jenkins and configured Source Code Management as Git. Please ensure Testng.xml file is present in the github/bitbucket(Make sure it is  added in the POM file and Properly committed and pushed to Git) or else it says testng.xml is not a valid file

2) Ensure you have added maven dependencies for TestNG 

3) Don't forget to add <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd"> at the top of TestNG.xml file 

Posted in Errors

org.openqa.selenium.TimeoutException: Supplied function might have stalled OR org.openqa.selenium.ElementNotInteractableException: OR element not interactable in headless chrome

I have faced this issue in Jenkins(Linux server) while running my Selenium with java scripts(TestNG, Maven) because i'm unable to maximize driver while running scripts in linux headless mode the only solution which resolved the issue was set the window size to maximum height and width
Below things didn't worked to maximize the chrome driver in headless mode in linux 

DriverManager.maximizeBrowser(driver);  
driver.manage().window().maximize();
driver.manage().window().fullscreen();

ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.addArguments("--start-maximized");
WebDriver driver= new ChromeDriver(chromeOptions);

Set the window size to maximum solved the issue 

ChromeOptions chromeOptions = new ChromeOptions();
options.addArguments("--window-size=1920,1080");
WebDriver driver= new ChromeDriver(chromeOptions);
Posted in Errors

WebDriverException: unknown error: DevToolsActivePort file doesn’t exist while trying to initiate Chrome Browser OR Chrome failed to start: exited abnormally OR ChromeDriver is assuming that Chrome has crashed.) through Selenium on Linux Ubuntu server in Jenkins

org.openqa.selenium.WebDriverException: 
unknown error: Chrome failed to start: exited abnormally.
  (unknown error: DevToolsActivePort file doesn't exist)
  (The process started from chrome location /snap/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)

The error implies that the ChromeDriver was unable to initiate a new WebBrowser. To do that add below chrome options most importantly headless for Linux

WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox");
options.addArguments("--disable-setuid-sandbox");
options.addArguments("--headless");
options.addArguments("--disable-dev-shm-usage");
driver = new ChromeDriver(options);
DriverManager.setDriver(driver);
DriverManager.maximizeBrowser(driver);
			        DriverManager.getDriver().manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
Posted in Errors

Cannot find Chrome binary when executing a selenium (testng) test in Jenkins on Linux server ? OR WebDriverException: unknown error: cannot find Chrome binary error with Selenium

http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
The solution to overcome org.openqa.selenium.WebDriverException: 
unknown error: cannot find Chrome binary  is To add below chrome options.
system.setProperty("webdriver.chrome.driver", "/usr/local/bin/chromedriver");
WebDriverManager.chromedriver().setup();
ChromeOptions options = new ChromeOptions();
options.addArguments("--no-sandbox");
options.addArguments("--disable-setuid-sandbox");
options.addArguments("--headless");
options.addArguments("--disable-dev-shm-usage");
driver = new ChromeDriver(options);

Posted in Errors

java.lang.IllegalStateException: The driver executable must exist: /var/lib/jenkins/workspace/..\drivers\chromedriver.exe

http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException









If you come across this error while executing tests in Jenkins(Linux Server) means chrome driver is not installed in the Jenkins before. Please do double check whether it is installed properly and ensure the path to the driver executable chromedriver.exe provided was correct.