Unable to execute TestCases over Linux

2019-02-07 14:54:11.940 ERROR c.k.k.core.keyword.internal.KeywordMain - :x: Unable to open browser with url: ‘’ (Root cause: 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 /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
(Driver info: chromedriver=2.43.600233 (523efee95e3d68b8719b3a1c83051aa63aa6b10d),platform=Linux 3.10.0-693.11.6.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)

Hi @Vivek

So I tried to google the exception and it seems that, to get it working you have to add some arguments to the Chrome Web Driver.

In your test case’s script mode, you can try to initiate ChromeDriver with the above options, as demonstrated in this documentation.

https://docs.katalon.com/katalon-studio/tutorials/using_selenium_webdriver_katalon_studio.html#options-and-capabilities

So your script may start with something like this:

import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import com.kms.katalon.core.webui.driver.DriverFactory

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

Please try and see if this workaround resolves the situation.

Regards !

Thanks Thanh To :slight_smile:
Yes, i will let you know if this works…

I have created a custom keyword
public class chromeBrowser {
@Keyword

def OpenBrowser(String url) {

	System.setProperty("webdriver.chrome.driver","/usr/local/bin/chromedriver");

	ChromeOptions options = new ChromeOptions();

	options.addArguments("–no-sandbox");

	options.addArguments("–disable-dev-shm-usage");

	options.setExperimentalOption("useAutomationExtension", false);

	WebDriver driver = new ChromeDriver(options); 
	 		
	DriverFactory.changeWebDriver(driver);

	driver.get(url);
}

}

and now i am getting

2019-02-07 17:42:06.025 INFO c.k.katalon.core.main.TestCaseExecutor - START Test Cases/Launch
2019-02-07 17:42:06.238 DEBUG testcase.Launch - 1: chromeBrowser.OpenBrowser(“https://…URL”)
2019-02-07 17:42:06.239 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - :x: chromeBrowser
2019-02-07 17:42:06.248 ERROR c.k.katalon.core.main.TestCaseExecutor - :x: chromeBrowser.OpenBrowser(“https…URL”) FAILED.
Reason:
java.lang.ClassNotFoundException: chromeBrowser
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.getCustomKeywordClassAndSetMetaClass(CustomKeywordDelegatingMetaClass.java:98)
at com.kms.katalon.core.main.CustomKeywordDelegatingMetaClass.invokeStaticMethod(CustomKeywordDelegatingMetaClass.java:44)
at Launch.run(Launch:17)

Hi @Vivek

I see the exception is telling you that your custom keyword class cannot be found. In your script have you followed the following method to use custom keywords ?

https://docs.katalon.com/katalon-studio/tutorials/create_custom_keyword.html#custom-keywords-in-scripting-view

Regards !

Hi @ThanhTo,

yes, i have done all the steps mentioned in the link. But still no success.

import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint
import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase
import static com.kms.katalon.core.testdata.TestDataFactory.findTestData
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject

import org.openqa.selenium.WebDriver
import org.openqa.selenium.chrome.ChromeOptions

import com.kms.katalon.core.annotation.Keyword
import com.kms.katalon.core.checkpoint.Checkpoint
import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import com.kms.katalon.core.model.FailureHandling
import com.kms.katalon.core.testcase.TestCase
import com.kms.katalon.core.testdata.TestData
import com.kms.katalon.core.testobject.TestObject
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.webui.driver.DriverFactory
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
import org.openqa.selenium.chrome.ChromeDriver

public class chromeBrowser {
@Keyword

def OpenBrowser(String url) {

	System.setProperty("webdriver.chrome.driver","/usr/local/bin/chromedriver");

	ChromeOptions options = new ChromeOptions();

	options.addArguments("-headless");

	options.addArguments("–no-sandbox");

	options.addArguments("–disable-dev-shm-usage");

	options.setExperimentalOption("useAutomationExtension", false);

	WebDriver driver = new ChromeDriver(options);

	DriverFactory.changeWebDriver(driver);

	driver.get(url);
}

}

======================
2019-02-08 09:07:05.688 ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - :x: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.34.522913 (36222509aa6e819815938cbf2709b4849735537c),platform=Linux 3.10.0-693.11.6.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.09 seconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘…’, ip: ‘…’, os.name: ‘Linux’, os.arch: ‘amd64’, os.version: ‘3.10.0-693.11.6.el7.x86_64’, java.version: ‘1.8.0_111’
Driver info: driver.version: ChromeDriver

Hi @Vivek

I notice that in your script, this line only has a single dash:

While the argument referred from the StackOverlflow post contains double dash:

Could you see if adding the dash into this line (as well as other lines) resolves the issue ?

Thanks !

no success.

ERROR k.k.c.m.CustomKeywordDelegatingMetaClass - :x: unknown error: Chrome failed to start: exited abnormally

what is the reason for this error.

Hi @Vivek

From this StackOverflow answer:

I think it’s because of compatibility between ChromeDriver and Chrome browser. Could you try upgrading and the solutions proposed by the StackOverflow answer ?

Regards !

i have tried all the solutions, but no success :frowning:

Hi @ThanhTo

This got fixed just using by removing this line of code “DriverFactory.changeWebDriver(driver);”

public class chromeBrowser {
@Keyword

def OpenBrowser(String url) {

	System.setProperty("webdriver.chrome.driver","/usr/local/bin/chromedriver");
	ChromeOptions options = new ChromeOptions();
	options.addArguments("--no-sandbox");
	options.add_argument("--disable-dev-shm-usage");
	options.setExperimentalOption("useAutomationExtension", false);
	WebDriver driver = new ChromeDriver(options);
	driver.get(url);
}

}

Thanks a lot
:slight_smile:

2 Likes

Hi @Vivek

Nice to see you got it fixed. Could you mark your own answer as solution so that others will have an easier time fixing this issue ?

Thanks !

Hi,

check this page
https://peter.sh/experiments/chromium-command-line-switches/
at least this is needed
--no-sandbox

Hi vivek !
Kindly please tell me that you have used a method add_argument("–disable-dev-shm-usage") is it true?
addArguments or add_argument ?
for me both are not working.