Often I am getting no such session error when I am running the scripts from Jenkins. What's the cause for it? Is there any connection failure or is it due to someother reason (I am running around 26 scripts and out of it atleast one script has no such session error)
The scripts are different scripts and no such session error is not again repeated for the same scripts
I met this kind of case sometimes. I use ChromeDriver with Laravel Dusk, rather than Selenium. However, I believe the cause is on ChromeDriver, not Selenium
ChromeDriver will create some cache files in folder:C:\Users\(yourAccountName)\AppData\Local\Temp
. In this folder, you will see many cache folders that look like scoped_dir1234_5678
. Each folder occupied around 10mb. If Jenkins runs ChromeDriver much frequently, ChromeDriver can overpopulate the cache file in the temp folder. You should think of 30-50GB cache files on your C drive and make full of your C driver.
When my C drive is out of space, ChromeDriver will not be able to start, and then return to me the error message "Facebook\WebDriver\Exception\NoSuchDriverException: no such session".
The solution:
--UPDATE--
Find another situation to cause the issue.
If your run same script to start ChromeDriver in two different instance at same time on same OS, when one instance is finished and shut down the chromedriver, the other chrome browser instance might be closed as well.
For example you open the two console and execute chromeDriver script, or your Jenkins project start at the same time.
I believe even if you run different script but require chromeDriver at same time, one of the script will have "no such session" due to the chrome browser instance shutdown.
solution:
My case is using Laravel Dusk without selenium. I am not sure if it will make different when test go through selenium server