Unable to run Edge in IE Compatibility mode on the Jenkins server - java

I have the following code that launches Edge in IE Compatibility mode:
case EDGE_COMPATIBILITY: {
logMessage(MessType.INFO, "Running Edge under compatibility mode.");
InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.introduceFlakinessByIgnoringSecurityDomains();
ieOptions.withEdgeExecutablePath("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");
ieOptions.attachToEdgeChrome();
ieOptions.destructivelyEnsureCleanSession();
System.setProperty("webdriver.ie.driver", projectLoc + "\\src\\externaljars\\selenium\\edgedriver\\iedriverserver.exe");
try {
logMessage(MessType.INFO, "About to create 'webdr'");
webdr = new InternetExplorerDriver(ieOptions);
logMessage(MessType.INFO, "Sleeping for 10 seconds.");
Thread.sleep(10000);
logMessage(MessType.INFO, "Done sleeping ...");
webdr.manage().window().maximize();
Thread.sleep(1000);
} catch (Exception e) {
e.printStackTrace();
}
break;
}
This works great when running the automated scripts locally, here is what it looks like:
TITLE Executing Method launchBrowser Time: [1:38:34PM]
INFO TEMP LOG MESSAGE : Data Source: DATABASE Browser: EDGE_COMPATIBILITY URL: null
INFO TEMP LOG MESSAGE : Browser: EDGE_COMPATIBILITY
INFO Running Edge under compatibility mode.
INFO About to create 'webdr'
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Started InternetExplorerDriver server (32-bit)
4.7.0.0
Listening on port 23537
Only local connections are allowed
INFO Sleeping for 10 seconds.
INFO Done sleeping ...
but when I try to run the same code from a Jenkins server, I get the following exception error:
14:02:26 [testng] TITLE Executing Method launchBrowser Time: [4:2:26PM]
14:02:26 [testng] INFO TEMP LOG MESSAGE : Data Source: DATABASE Browser: EDGE_COMPATIBILITY URL: null
14:02:26 [testng] INFO TEMP LOG MESSAGE : Browser: EDGE_COMPATIBILITY
14:02:26 [testng] INFO Running Edge under compatibility mode.
14:02:26 [testng] INFO About to create 'webdr'
14:02:27 [testng] Started InternetExplorerDriver server (32-bit)
14:02:27 [testng] 4.7.0.0
14:02:27 [testng] Listening on port xxxxxx
14:02:27 [testng] Only local connections are allowed
14:05:28 [testng] org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
14:05:28 [testng] Host info: host: 'xxxxxxxxxx', ip: 'xx.xx.xx.xx'
14:05:28 [testng] Build info: version: '4.6.0', revision: '79f1c02ae20'
14:05:28 [testng] System info: os.name: 'Windows Server 2016', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.11'
14:05:28 [testng] Driver info: org.openqa.selenium.ie.InternetExplorerDriver
14:05:28 [testng] Command: [null, newSession {capabilities=[Capabilities {browserName: internet explorer, se:ieOptions: {ie.edgepath: C:\Program Files (x86)\Micr..., ignoreProtectedModeSettings: true}}], desiredCapabilities=Capabilities {browserName: internet explorer, se:ieOptions: {ie.edgepath: C:\Program Files (x86)\Micr..., ignoreProtectedModeSettings: true}}}]
14:05:28 [testng] Capabilities {}
14:05:28 [testng] at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:559)
What is even more interesting is that if I log onto the Jenkins server to see what's going on, then I don't get the exception error. It is as though attaching a screen output completes the instantiation process.
Does anyone know whether this is a Jenkins limitation? Or are there any other InternetOptions that I should be using.

Related

Selenium: Session not created - the target machine actively refused it (when launching dozens of parallel FF instances)

I recently upgraded to Selenium version 4 and it seems to be causing more harm than good.
When I try running a single (or a small number) of WebDriver instances in parallel via the command:
WebDriver driver = new FirefoxDriver(firefoxOptions);
Selenium launches as expected. However, when I try running dozens of instances at one time I get the following errors:
1649745964100 geckodriver INFO Listening on 127.0.0.1:50788
1649745964101 geckodriver INFO Listening on 127.0.0.1:55599
1649745964103 geckodriver INFO Listening on 127.0.0.1:62022
1649745964105 geckodriver INFO Listening on 127.0.0.1:57781
1649745964106 geckodriver INFO Listening on 127.0.0.1:60187
...
1649745964966 mozrunner::runner INFO Running command: "C:\\MyApp\\Files\\Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "52303" "-no-remote" "-profile" "C:\\Users\\User\\AppData\\Local\\Temp\\rust_mozprofile49eIxp"
1649745964969 mozrunner::runner INFO Running command: "C:\\MyApp\\Files\\Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "62028" "-no-remote" "-profile" "C:\\Users\\User\\AppData\\Local\\Temp\\rust_mozprofile1awb0N"
1649745964971 mozrunner::runner INFO Running command: "C:\\MyApp\\Files\\Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "62582" "-no-remote" "-profile" "C:\\Users\\User\\AppData\\Local\\Temp\\rust_mozprofileX7Iv6n"
1649745964972 mozrunner::runner INFO Running command: "C:\\MyApp\\Files\\Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "53475" "-no-remote" "-profile" "C:\\Users\\User\\AppData\\Local\\Temp\\rust_mozprofilehOG354"
1649745964973 mozrunner::runner INFO Running command: "C:\\MyApp\\Files\\Firefox\\firefox.exe" "--marionette" "--remote-debugging-port" "54847" "-no-remote" "-profile" "C:\\Users\\User\\AppData\\Local\\Temp\\rust_mozprofile6m4dJU"
...
1649745965124 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:57736
1649745965124 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:57783
1649745965124 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:57757
1649745965125 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:57740
1649745965125 geckodriver::marionette DEBUG Waiting 60s to connect to browser on 127.0.0.1:57782
...
1649745966721 RemoteAgent DEBUG CDP enabled
1649745966721 RemoteAgent DEBUG CDP enabled
1649745966721 Marionette INFO Marionette enabled
1649745966721 Marionette INFO Marionette enabled
1649745966721 RemoteAgent DEBUG CDP enabled
...
1649745967088 geckodriver::marionette TRACE No connection could be made because the target machine actively refused it. (os error 10061). Retrying in 100ms
1649745967089 geckodriver::marionette TRACE No connection could be made because the target machine actively refused it. (os error 10061). Retrying in 100ms
1649745967090 geckodriver::marionette TRACE No connection could be made because the target machine actively refused it. (os error 10061). Retrying in 100ms
1649745967104 geckodriver::marionette TRACE No connection could be made because the target machine actively refused it. (os error 10061). Retrying in 100ms
1649745967104 geckodriver::marionette TRACE No connection could be made because the target machine actively refused it. (os error 10061). Retrying in 100ms
...
1649745968454 Marionette TRACE Received observer notification toplevel-window-ready
1649745968471 Marionette TRACE Received observer notification toplevel-window-ready
1649745968477 Marionette TRACE Received observer notification toplevel-window-ready
1649745968477 Marionette TRACE Received observer notification toplevel-window-ready
1649745968486 Marionette TRACE Received observer notification toplevel-window-ready
...
console.error: Region.jsm: "Failed to fetch region" (new Error("TIMEOUT", "resource://gre/modules/Region.jsm", 419))
console.error: Region.jsm: "Error fetching region" (new Error("TIMEOUT", "resource://gre/modules/Region.jsm", 772))
console.error: Region.jsm: "Failed to fetch region" (new Error("TIMEOUT", "resource://gre/modules/Region.jsm", 419))
console.error: Region.jsm: "Error fetching region" (new Error("TIMEOUT", "resource://gre/modules/Region.jsm", 772))
console.error: Region.jsm: "Failed to fetch region" (new Error("TIMEOUT", "resource://gre/modules/Region.jsm", 419))
...
1649746120764 geckodriver::browser DEBUG Browser process stopped: exit code: 1
1649746120767 geckodriver::browser DEBUG Browser process stopped: exit code: 1
1649746120769 geckodriver::browser DEBUG Browser process stopped: exit code: 1
1649746120770 geckodriver::browser DEBUG Browser process stopped: exit code: 1
1649746120770 geckodriver::browser DEBUG Browser process stopped: exit code: 1
...
org.openqa.selenium.SessionNotCreatedException
...
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Possible causes are invalid address of the remote server or browser start-up failure.
What's stopping Selenium from creating new browser sessions? It's obviously not a Firewall issue as the code runs without issue when I limit to a handful of browsers.
I'm using Java. I never had an issue launching dozens of browsers in Selenium v3.
What changed in v4 that's causing this issue? I'm using local WebDriver (NOT Remote Web Driver)
Update:
As requested by #undetected Selenium please see additional debug info below:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: No connection could be made because the target machine actively refused it. (os error 10061)
Build info: version: '4.1.3', revision: '7b1ebf28ef'
System info: host: 'MyHost', ip: '17X.XX.XX.X', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
Driver info: org.openqa.selenium.firefox.FirefoxDriver
Command: [null, newSession {capabilities=[Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {binary: C:\MyApp\Files\Firef..., log: {level: trace}, prefs: {browser.cache.disk.capacity: 1024, datareporting.policy.dataSubmissionPolicyAccepted: false, dom.max_chrome_script_run_time: 0, dom.max_script_run_time: 0, dom.popup_maximum: 200, dom.webnotifications.enabled: false, general.useragent.override: Mozilla/5.0 (Windows NT 10...., media.peerconnection.enabled: false, network.proxy.http: 127.0.0.1, network.proxy.http_port: 24000, network.proxy.socks: 127.0.0.1, network.proxy.socks_port: 24000, network.proxy.socks_remote_dns: true, network.proxy.type: 1}}}], desiredCapabilities=Capabilities {acceptInsecureCerts: true, browserName: firefox, moz:debuggerAddress: true, moz:firefoxOptions: {binary: C:\MyApp\Files\Firef..., log: {level: trace}, prefs: {browser.cache.disk.capacity: 1024, datareporting.policy.dataSubmissionP
olicyAccepted: false, dom.max_chrome_script_run_time: 0, dom.max_script_run_time: 0, dom.popup_maximum: 200, dom.webnotifications.enabled: false, general.useragent.override: Mozilla/5.0 (Windows NT 10...., media.peerconnection.enabled: false, network.proxy.http: 127.0.0.1, network.proxy.http_port: 24000, network.proxy.socks: 127.0.0.1, network.proxy.socks_port: 24000, network.proxy.socks_remote_dns: true, network.proxy.type: 1}}}}]
Apr 12, 2022 1:12:15 PM org.openqa.selenium.os.OsProcess destroy
INFO: Unable to drain process streams. Ignoring but the exception being swallowed follows.
org.apache.commons.exec.ExecuteException: The stop timeout of 2000 ms was exceeded (Exit value: -559038737)
at org.apache.commons.exec.PumpStreamHandler.stopThread(PumpStreamHandler.java:295)
at org.apache.commons.exec.PumpStreamHandler.stop(PumpStreamHandler.java:180)
at org.openqa.selenium.os.OsProcess.destroy(OsProcess.java:135)
at org.openqa.selenium.os.CommandLine.destroy(CommandLine.java:139)
at org.openqa.selenium.remote.service.DriverService.stop(DriverService.java:281)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:154)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:567)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:248)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:164)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:118)
at org.openqa.selenium.firefox.FirefoxDriver.<init>(FirefoxDriver.java:106)
at webdriverX.WebDriverX.launchNewFireFoxWebDriver(WebDriverX.java:150)
at webdriverX.WebDriverProfile.getTMPFirefoxProfile(WebDriverProfile.java:1030)
at webdriverX.WebDriverProfile.getTMPFirefoxProfile(WebDriverProfile.java:1165)
at webdriverX.WebDriverProfile.requestWebDriver(WebDriverProfile.java:735)
at fulfilment.source.pages.ProductPage.ProductTestSuit.scrapeField(ProductTestSuit.java:89)
at fulfilment.source.pages.ProductPage.ProductTestSuit$1.run(ProductTestSuit.java:52)
Update #2:
Please see some of the actual code used to launch dozens of instances of Firefox WebDriver:
public static void scrapeField(List<String> urlList) throws Exception {
for (String url : urlList) {
new Thread() {
public void run() {
try {
scrapeField(url);
} catch (Exception v) {
System.out.println(v);
}
}
}.start();
}
}
The method scrapeField() essentially calls the method getTMPFirefoxProfile() which returns 1 instance of Firefox WebDriver per URL as seen below:
public static WebDriver getTMPFirefoxProfile(String ipAddress, Integer port) throws IOException, {
System.setProperty("webdriver.gecko.driver", path_to_exe_file);
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.addPreference("browser.cache.disk.capacity", 1024);
firefoxOptions.addPreference("dom.popup_maximum", 200);
firefoxOptions.addPreference("dom.webnotifications.enabled", false);
firefoxOptions.addPreference("media.peerconnection.enabled", false);
firefoxOptions.addPreference("media.peerconnection.enabled", false);
firefoxOptions.addPreference("datareporting.policy.dataSubmissionPolicyAccepted", false);
firefoxOptions.addPreference("dom.max_chrome_script_run_time", 0);
firefoxOptions.addPreference("dom.max_script_run_time", 0);
firefoxOptions.addPreference("media.peerconnection.enabled", false);
firefoxOptions.setLogLevel(FirefoxDriverLogLevel.TRACE);
firefoxOptions.addPreference("general.useragent.override", rndUserAgentStr);
firefoxOptions.addPreference("network.proxy.type", 1);
firefoxOptions.addPreference("network.proxy.socks", ipAddress);
firefoxOptions.addPreference("network.proxy.socks_port", port);
firefoxOptions.addPreference("network.proxy.http", ipAddress);
firefoxOptions.addPreference("network.proxy.http_port", port);
firefoxOptions.addPreference("network.proxy.socks_remote_dns", true);
firefoxOptions.setBinary(path_to_binary_firefox);
WebDriver driver = new FirefoxDriver(firefoxOptions);
return driver;
}

org.openqa.selenium.TimeoutException: connection refused error while running headless firefox browser in Ubuntu using AutoCloseable

Error:
org.openqa.selenium.TimeoutException: connection refused
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:48'
System info: host: 'ubuntu', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-112-generic', java.version: '1.8.0_252'
Driver info: driver.version: FirefoxDriver
Code:
System.setProperty("webdriver.gecko.driver", "/usr/bin/geckodriver");
FirefoxOptions firefoxOptions = new FirefoxOptions();
firefoxOptions.setHeadless(true);
java.util.logging.Logger.getLogger("org.openqa.selenium").setLevel(Level.OFF);
System.out.println(1);
WebDriver driver = new FirefoxDriver(firefoxOptions);
// code does not reach this point. Look like its freezing at the initialisation of 'driver'.
try (AutoCloseable autoCloseable = () -> driver.close()) {
...
I have changed Java Version as another question recommended (from 11 to 8).
EDIT: That post (Java Selenium Webdriver Connection Refused) did not work.
EDIT #2: I am running it through Tomcat 9.
I don't see any such issue with your code block. I took your code and executed with the following configuration:
OS: windows-10
java-8: JDK 8u251
Selenium: Latest stable version 3.141.59
GeckoDriver: GeckoDriver v0.26.0
Firefox: Latest stable version 79.0
Execution details
Here are the execution details using autocloseable:
Code Block:
import java.util.logging.Level;
import org.openqa.selenium.firefox.FirefoxDriver;
//import org.openqa.selenium.firefox.FirefoxDriverLogLevel;
import org.openqa.selenium.firefox.FirefoxOptions;
public class AutoCloseableSelenium {
public static void main(String[] args) throws Exception {
System.setProperty("webdriver.gecko.driver","C:\\WebDrivers\\geckodriver.exe");
FirefoxOptions options = new FirefoxOptions();
options.setHeadless(true);
//options.setLogLevel(FirefoxDriverLogLevel.TRACE);
java.util.logging.Logger.getLogger("org.openqa.selenium").setLevel(Level.OFF);
System.out.println(1);
FirefoxDriver driver = new FirefoxDriver(options);
try (AutoCloseable autoCloseable = () -> driver.quit()) { }
System.out.println("Exiting program");
}
}
Console Output:
1
1595977246813 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-headless" "-foreground" "-no-remote" "-profile" "C:\\Users\\SOMABH~1\\AppData\\Local\\Temp\\rust_mozprofile345iC4"
*** You are running in headless mode.
JavaScript error: resource://gre/modules/XULStore.jsm, line 66: Error: Can't find profile directory.
console.error: SearchCache: "_readCacheFile: Error reading cache file:" (new Error("", "(unknown module)"))
1595977254325 Marionette INFO Listening on port 53331
1595977254676 Marionette WARN TLS certificate errors will be ignored for this session
1595977254896 Marionette INFO Stopped listening on port 53331
JavaScript error: resource://activity-stream/lib/ActivityStreamPrefs.jsm, line 27: NS_ERROR_ILLEGAL_VALUE: Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [nsIPrefBranch.removeObserver]
console.warn: services.settings: main/messaging-experiments sync interrupted by shutdown
JavaScript error: resource://services-settings/IDBHelpers.jsm, line 24: Error: IndexedDB: main/fxmonitor-breaches list() IndexedDB: execute() The application is shutting down
JavaScript error: resource://gre/modules/Sqlite.jsm, line 928: Error: Connection is not open.
Exiting program

Only local connections are allowed. Chrome failed to start: crashed. (unknown error: DevToolsActivePort file doesn't exist [duplicate]

This question already has answers here:
Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed
(22 answers)
Closed 2 years ago.
I am running Selenium Automation Script From Jenkins+Git+Maven. in local machine, the script working absolutely Perfect but when I run this from Jenkins it gives me below error.
OS Linux
chrome driver version 83.0.4103.39
chrome version 83.0.4103.61
System.setProperty("webdriver.chrome.driver", "/usr/bin/chromedriver");
ChromeOptions opt = new ChromeOptions();
opt.setBinary("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"); //chrome binary location specified here
opt.addArguments("start-maximized");
opt.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));
opt.setExperimentalOption("useAutomationExtension", false);
driver = new ChromeDriver();
T E S T S
Running com.spicetag.qa.testcases.LoginPageTest
log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103#{#416}) on port 15818
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Tests run: 9, Failures: 1, Errors: 0, Skipped: 8, Time elapsed: 2.189 sec <<< FAILURE! - in com.spicetag.qa.testcases.LoginPageTest
setup(com.spicetag.qa.testcases.LoginPageTest) Time elapsed: 2.021 sec <<< FAILURE!
org.openqa.selenium.WebDriverException:
unknown error: Chrome failed to start: crashed.
(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.)
Build info: version: '4.0.0-alpha-5', revision: 'b3a0d621cc'
System info: host: 'shankar', ip: '192.168.43.69', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-91-generic', java.version: '11.0.7'
Driver info: driver.version: ChromeDriver
remote stacktrace: #0 0x563918a38579
at com.spicetag.qa.testcases.LoginPageTest.setup(LoginPageTest.java:29)
Results :
Looks like you need to change the path
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
To the right path chrome.driver
If it still doesn't work, please paste the error code

errors after migration from Selenium 2.47.0 to Selenium 3.13.0 with FF 54

so I finally decided to migrate my framework from 2.47.0 to 3.13.0. Here are the things I changed:1. Removed selenium 2.47.0 jar files and added 3.13.0 jar files to build path2. Downloaded Gecko driver 0.21.03. Updated FF to 54 (tried latest 62 too)4. Updated selenium dependency to 3.13.0 in pom.xml5. My java version is 1.8.0_171
I am testing this migration with test project.
public class Test1 {
public static WebDriver driver;
#BeforeTest
public void setUpDriver() throws IOException, InterruptedException {
//FirefoxOptions options = new FirefoxOptions();
//options.setCapability("marionette", false);
System.setProperty("webdriver.gecko.driver", "C:\\Users\\****\\Downloads\\geckodriver-v0.21.0-win64\\geckodriver.exe");
driver = new FirefoxDriver();
driver.manage().window().maximize();
}
#Test(priority=1)
public void test() throws InterruptedException {
driver.get("https://google.com");
}
I am getting following exception when I run this:
Running TestSuite
1532713601535 geckodriver INFO geckodriver 0.21.0
1532713601547 geckodriver INFO Listening on 127.0.0.1:3012
1532713602248 mozrunner::runner INFO Running command: "C:\\Program Files\\Mozilla Firefox\\firefox.exe" "-marionette" "-foreground" "-no-remote" "-profile" "C:\\Users\\******\\AppData\\Local\\Temp\\rust_mozprofile.LUNdmVpn3N1s"
[GFX1]: Potential driver version mismatch ignored due to missing DLLs igd10umd64 v= and igd10iumd64.dll v=0.0.0.0
1532713605654 Marionette INFO Listening on port 50526
Jul 27, 2018 1:47:56 PM org.openqa.selenium.remote.ErrorCodes toStatus
INFO: HTTP Status: '404' -> incorrect JSON status mapping for 'unknown error' (500 expected)
Tests run: 2, Failures: 1, Errors: 0, Skipped: 1, Time elapsed: 76.062 sec <<< FAILURE! - in TestSuite
setUpDriver(********.Test1) Time elapsed: 75.988 sec <<< FAILURE!
org.openqa.selenium.WebDriverException:
WebDriver:NewSession
Build info: version: '3.13.0', revision: '2f0d292', time: '2018-06-25T15:24:21.231Z'
System info: host: '******-LAPTOP', ip: '*******', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_171'
Driver info: driver.version: FirefoxDriver
remote stacktrace: WebDriverError#chrome://marionette/content/error.js:211:5
UnknownCommandError#chrome://marionette/content/error.js:455:5
execute/req<#chrome://marionette/content/server.js:503:15
TaskImpl_run#resource://gre/modules/Task.jsm:319:42
TaskImpl#resource://gre/modules/Task.jsm:277:3
asyncFunction#resource://gre/modules/Task.jsm:252:14
Task_spawn#resource://gre/modules/Task.jsm:166:12
execute#chrome://marionette/content/server.js:500:15
onPacket#chrome://marionette/content/server.js:471:7
_onJSONObjectReady/<#chrome://marionette/content/server.js -> resource://devtools/shared/transport/transport.js:483:11
exports.makeInfallible/<#resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/ThreadSafeDevToolsUtils.js:101:14
exports.makeInfallible/<#resource://gre/modules/commonjs/toolkit/loader.js -> resource://devtools/shared/ThreadSafeDevToolsUtils.js:101:14
NOTE: I tried setting marionette to false with FF 47.0 and Selenium 3.13.0 and it worked fine but I want to use latest FF version so I want to make sure its working with Geckodriver. Any help would be greatlyappreciated.
sorted it out by downgrading my gecko driver to v0.16.1

Working with chromedriver in unit-tests, with browser.quit()

On our project, was decided to use ui-tests as unit-tests. For this we wrote several tests. All of them use one port. Before running tests I execute command from command line (by CI): nohup Xvfb :2 -screen 0 1920x1080x24 & chromedriver --whitelisted-ips --port = 60000 (DISPLAY and PATH, of course, are set in the same session).
If the browser is not closed after tests, it works fine. But we can not do this. It must be closed after each test. If I do:
} finally {
browser.quit();
}
first test is ok. But after this, we have hang process chromedriver, and used port 60000 (those, I can't run listener: chromedriver --whitelisted-ips --port = 60000 and so on). And next test failed:
DEBUG org.apache.http.wire - << "{"sessionId":"be69384516355ddaefd5951a10fa3f82","status":13,"value":{"message":"unknown error: Chrome failed to start: exited abnormally\n (Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 3.13.0-45-generic x86_64)"}}"
[main] DEBUG org.apache.http.impl.conn.DefaultClientConnection - Connection 0.0.0.0:34493<->127.0.0.1:60000 shut down
[main] DEBUG org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager - Released connection is not reusable.
[main] DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute - Releasing connection [{}->http://localhost:60000][null]
[main] DEBUG org.apache.http.impl.conn.DefaultClientConnection - Connection 0.0.0.0:34493<->127.0.0.1:60000 closed
[main] DEBUG org.apache.http.impl.conn.tsccm.ConnPoolByRoute - Notifying no-one, there are no waiting threads
...
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.28.455506 (18f6627e265f442aeec9b6661a49fe819aeeea1f),platform=Linux 3.13.0-45-generic x86_64) (WARNING: The server did not provide any stacktrace information); duration or timeout: 60.03 seconds
Build info: version: '2.10.0', revision: '14416', time: '2011-10-27 23:00:15'
ystem info: os.name: 'Linux', os.arch: 'amd64', os.version: '3.13.0-45-generic', java.version: '1.6.0'
Driver info: driver.version: ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:56)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:39)
at java.lang.reflect.Constructor.newInstance(Constructor.java:527)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:147)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:113)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:417)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:115)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:76)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:120)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:98)
at ru.blogic.lecm.plugin.base.test.executor.DOHTestUIExecutor.execute(DOHTestUIExecutor.java:74)
at ru.blogic.lecm.plugin.base.test.executor.DOHTestExecutor.testUI(DOHTestExecutor.java:78)
at ru.blogic.lecm.plugin.base.test.executor.DOHTestExecutor.test(DOHTestExecutor.java:65)
at ru.blogic.lecm.plugin.base.test.examples.DOHDemoNoUITest.testUtils(DOHDemoNoUITest.java:20)
I tried to run listener from java code at tests start, like this:
Runtime.getRuntime().exec("export DISPLAY=:2 & export PATH=$PATH:/usr/lib/chromium-browser/ & nohup Xvfb :2 -screen 0 1920x1080x24 & chromedriver --whitelisted-ips --port=60000");
and in finally block I try to kill process hardly:
Runtime.getRuntime().exec("pkill chromedriver");
but nothing changed.

Categories