Selenium webdriver Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:9515How can you find out which process is listening on a port on Windows?How to fix “WebDriverException: Message: connection refused”?Page load strategy for Chrome driver (Updated till Selenium v3.12.0)ConnectionResetError: [Errno 104] Connection reset by peer and ERR_NAME_NOT_RESOLVED on heroku with mobile testing through SeleniumHow to fix python-selenium error “connection refused” when initializing a selenium webdriver?“Eager” Page Load Strategy workaround for Chromedriver Selenium in PythonHow to take screenshot with Selenium WebDriverGet HTML Source of WebElement in Selenium WebDriver using PythonHow to run Selenium WebDriver test cases in Chrome?RemoteWebDriver with ChromeTrouble with installing Selenium(ChromeDriver, Javascript) on Windows 7org.openqa.selenium.WebDriverException: chrome not reachableHeroku: unable to connect to chromedriver 127.0.0.1:9515 when using Watir/SeleniumChromeDriver hanging sporadically, DevTools request failed. Chrome not reachable errorTesting Electron Applications With Robot Framework's Selenium2LibrarySelenium WebDriver loses connection to web page
What is the most common color to indicate the input-field is disabled?
Cursor Replacement for Newbies
Watching something be piped to a file live with tail
GFCI outlets - can they be repaired? Are they really needed at the end of a circuit?
Solving a recurrence relation (poker chips)
Could the museum Saturn V's be refitted for one more flight?
What do you call someone who asks many questions?
Do UK voters know if their MP will be the Speaker of the House?
What exploit Are these user agents trying to use?
Why doesn't using multiple commands with a || or && conditional work?
Reverse dictionary where values are lists
Examples of smooth manifolds admitting inbetween one and a continuum of complex structures
Personal Teleportation: From Rags to Riches
What mechanic is there to disable a threat instead of killing it?
Can I run a new neutral wire to repair a broken circuit?
Avoiding the "not like other girls" trope?
Can a virus destroy the BIOS of a modern computer?
How seriously should I take size and weight limits of hand luggage?
Can my sorcerer use a spellbook only to collect spells and scribe scrolls, not cast?
What is a romance in Latin?
I would say: "You are another teacher", but she is a woman and I am a man
How do I handle a potential work/personal life conflict as the manager of one of my friends?
Forgetting the musical notes while performing in concert
Why can't we play rap on piano?
Selenium webdriver Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:9515
How can you find out which process is listening on a port on Windows?How to fix “WebDriverException: Message: connection refused”?Page load strategy for Chrome driver (Updated till Selenium v3.12.0)ConnectionResetError: [Errno 104] Connection reset by peer and ERR_NAME_NOT_RESOLVED on heroku with mobile testing through SeleniumHow to fix python-selenium error “connection refused” when initializing a selenium webdriver?“Eager” Page Load Strategy workaround for Chromedriver Selenium in PythonHow to take screenshot with Selenium WebDriverGet HTML Source of WebElement in Selenium WebDriver using PythonHow to run Selenium WebDriver test cases in Chrome?RemoteWebDriver with ChromeTrouble with installing Selenium(ChromeDriver, Javascript) on Windows 7org.openqa.selenium.WebDriverException: chrome not reachableHeroku: unable to connect to chromedriver 127.0.0.1:9515 when using Watir/SeleniumChromeDriver hanging sporadically, DevTools request failed. Chrome not reachable errorTesting Electron Applications With Robot Framework's Selenium2LibrarySelenium WebDriver loses connection to web page
I'm using NodeJS selenium within my electron desktop application.
"electron-chromedriver": "^4.0.0-beta.1",
"selenium-webdriver": "^4.0.0-alpha.1",
I followed electron documentation about using selenium inside electron app and I have code like this:
let chromeCapabilities = webdriver.Capabilities.chrome();
let chromeOptions = 'args': ['--disable-infobars'] ;
chromeCapabilities.set('chromeOptions', chromeOptions);
capabilities.setPageLoadStrategy('eager');
this.driver = new webdriver.Builder()
.withCapabilities(chromeCapabilities)
.usingServer('http://localhost:9515')
.forBrowser('chrome')
.build();
after above code there is chain of promises which are doing many different things.
Except that I'm runing chromedriver command in terminal within ./node_modules/.bin/ directory.
Starting ChromeDriver 69.0.3497.106 (857b284701ddf7bef0f14fa76416cf7ca786b411) on port 9515
Only local connections are allowed.
Now when I run entire code it sometimes works correctly but occasionally it print error in terminal in which I npm run dev electron app:
Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:9515
I read several similiar SO questions but none of them was helpful. I don't really understand how it's possible that some piece of code is sometimes working and sometimes causing error.
I also checked ports 9515 (chromedriver) and 9080 (electron nodeJS) after getting error and everything looks fine:

I've done some more debugging and I found out that probably this:
webElement.getAttribute('style')
is sometimes causing my error. When I delete above (and also .then() and .catch after it ofcourse) error stop occuring. However I don't know how geting inline styles of webElement might be relevant to connection refused error.
node.js selenium
|
show 5 more comments
I'm using NodeJS selenium within my electron desktop application.
"electron-chromedriver": "^4.0.0-beta.1",
"selenium-webdriver": "^4.0.0-alpha.1",
I followed electron documentation about using selenium inside electron app and I have code like this:
let chromeCapabilities = webdriver.Capabilities.chrome();
let chromeOptions = 'args': ['--disable-infobars'] ;
chromeCapabilities.set('chromeOptions', chromeOptions);
capabilities.setPageLoadStrategy('eager');
this.driver = new webdriver.Builder()
.withCapabilities(chromeCapabilities)
.usingServer('http://localhost:9515')
.forBrowser('chrome')
.build();
after above code there is chain of promises which are doing many different things.
Except that I'm runing chromedriver command in terminal within ./node_modules/.bin/ directory.
Starting ChromeDriver 69.0.3497.106 (857b284701ddf7bef0f14fa76416cf7ca786b411) on port 9515
Only local connections are allowed.
Now when I run entire code it sometimes works correctly but occasionally it print error in terminal in which I npm run dev electron app:
Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:9515
I read several similiar SO questions but none of them was helpful. I don't really understand how it's possible that some piece of code is sometimes working and sometimes causing error.
I also checked ports 9515 (chromedriver) and 9080 (electron nodeJS) after getting error and everything looks fine:

I've done some more debugging and I found out that probably this:
webElement.getAttribute('style')
is sometimes causing my error. When I delete above (and also .then() and .catch after it ofcourse) error stop occuring. However I don't know how geting inline styles of webElement might be relevant to connection refused error.
node.js selenium
Where is your server hosted?
– Rohit Dalal
Mar 16 at 8:46
I'm runing code locally. I've created my electron app using electron-vue cli boilerplate.npm run devwhich I call from terminal is runing script"dev": "node .electron-vue/dev-runner.js",which open local server. The file is: gist.github.com/BorysTyminski/0dd37249b274c12796b030b565671564
– BT101
Mar 16 at 8:52
whats the output of command - "lsof -i :9515" when the connection is refused?
– Rohit Dalal
Mar 16 at 8:56
Well I can't really run any command until I stop server with ctrl+C. Except that I'm using windows10. I don't know if commandlsofis recognized command in windows.
– BT101
Mar 16 at 9:04
My bad. Poweshell and cmd are both available to run commands. See stackoverflow.com/questions/48198/… for seeing whats running on your port
– Rohit Dalal
Mar 16 at 9:08
|
show 5 more comments
I'm using NodeJS selenium within my electron desktop application.
"electron-chromedriver": "^4.0.0-beta.1",
"selenium-webdriver": "^4.0.0-alpha.1",
I followed electron documentation about using selenium inside electron app and I have code like this:
let chromeCapabilities = webdriver.Capabilities.chrome();
let chromeOptions = 'args': ['--disable-infobars'] ;
chromeCapabilities.set('chromeOptions', chromeOptions);
capabilities.setPageLoadStrategy('eager');
this.driver = new webdriver.Builder()
.withCapabilities(chromeCapabilities)
.usingServer('http://localhost:9515')
.forBrowser('chrome')
.build();
after above code there is chain of promises which are doing many different things.
Except that I'm runing chromedriver command in terminal within ./node_modules/.bin/ directory.
Starting ChromeDriver 69.0.3497.106 (857b284701ddf7bef0f14fa76416cf7ca786b411) on port 9515
Only local connections are allowed.
Now when I run entire code it sometimes works correctly but occasionally it print error in terminal in which I npm run dev electron app:
Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:9515
I read several similiar SO questions but none of them was helpful. I don't really understand how it's possible that some piece of code is sometimes working and sometimes causing error.
I also checked ports 9515 (chromedriver) and 9080 (electron nodeJS) after getting error and everything looks fine:

I've done some more debugging and I found out that probably this:
webElement.getAttribute('style')
is sometimes causing my error. When I delete above (and also .then() and .catch after it ofcourse) error stop occuring. However I don't know how geting inline styles of webElement might be relevant to connection refused error.
node.js selenium
I'm using NodeJS selenium within my electron desktop application.
"electron-chromedriver": "^4.0.0-beta.1",
"selenium-webdriver": "^4.0.0-alpha.1",
I followed electron documentation about using selenium inside electron app and I have code like this:
let chromeCapabilities = webdriver.Capabilities.chrome();
let chromeOptions = 'args': ['--disable-infobars'] ;
chromeCapabilities.set('chromeOptions', chromeOptions);
capabilities.setPageLoadStrategy('eager');
this.driver = new webdriver.Builder()
.withCapabilities(chromeCapabilities)
.usingServer('http://localhost:9515')
.forBrowser('chrome')
.build();
after above code there is chain of promises which are doing many different things.
Except that I'm runing chromedriver command in terminal within ./node_modules/.bin/ directory.
Starting ChromeDriver 69.0.3497.106 (857b284701ddf7bef0f14fa76416cf7ca786b411) on port 9515
Only local connections are allowed.
Now when I run entire code it sometimes works correctly but occasionally it print error in terminal in which I npm run dev electron app:
Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:9515
I read several similiar SO questions but none of them was helpful. I don't really understand how it's possible that some piece of code is sometimes working and sometimes causing error.
I also checked ports 9515 (chromedriver) and 9080 (electron nodeJS) after getting error and everything looks fine:

I've done some more debugging and I found out that probably this:
webElement.getAttribute('style')
is sometimes causing my error. When I delete above (and also .then() and .catch after it ofcourse) error stop occuring. However I don't know how geting inline styles of webElement might be relevant to connection refused error.
node.js selenium
node.js selenium
edited Mar 23 at 11:47
DebanjanB
46.4k134790
46.4k134790
asked Mar 16 at 8:40
BT101BT101
1652626
1652626
Where is your server hosted?
– Rohit Dalal
Mar 16 at 8:46
I'm runing code locally. I've created my electron app using electron-vue cli boilerplate.npm run devwhich I call from terminal is runing script"dev": "node .electron-vue/dev-runner.js",which open local server. The file is: gist.github.com/BorysTyminski/0dd37249b274c12796b030b565671564
– BT101
Mar 16 at 8:52
whats the output of command - "lsof -i :9515" when the connection is refused?
– Rohit Dalal
Mar 16 at 8:56
Well I can't really run any command until I stop server with ctrl+C. Except that I'm using windows10. I don't know if commandlsofis recognized command in windows.
– BT101
Mar 16 at 9:04
My bad. Poweshell and cmd are both available to run commands. See stackoverflow.com/questions/48198/… for seeing whats running on your port
– Rohit Dalal
Mar 16 at 9:08
|
show 5 more comments
Where is your server hosted?
– Rohit Dalal
Mar 16 at 8:46
I'm runing code locally. I've created my electron app using electron-vue cli boilerplate.npm run devwhich I call from terminal is runing script"dev": "node .electron-vue/dev-runner.js",which open local server. The file is: gist.github.com/BorysTyminski/0dd37249b274c12796b030b565671564
– BT101
Mar 16 at 8:52
whats the output of command - "lsof -i :9515" when the connection is refused?
– Rohit Dalal
Mar 16 at 8:56
Well I can't really run any command until I stop server with ctrl+C. Except that I'm using windows10. I don't know if commandlsofis recognized command in windows.
– BT101
Mar 16 at 9:04
My bad. Poweshell and cmd are both available to run commands. See stackoverflow.com/questions/48198/… for seeing whats running on your port
– Rohit Dalal
Mar 16 at 9:08
Where is your server hosted?
– Rohit Dalal
Mar 16 at 8:46
Where is your server hosted?
– Rohit Dalal
Mar 16 at 8:46
I'm runing code locally. I've created my electron app using electron-vue cli boilerplate.
npm run dev which I call from terminal is runing script "dev": "node .electron-vue/dev-runner.js", which open local server. The file is: gist.github.com/BorysTyminski/0dd37249b274c12796b030b565671564– BT101
Mar 16 at 8:52
I'm runing code locally. I've created my electron app using electron-vue cli boilerplate.
npm run dev which I call from terminal is runing script "dev": "node .electron-vue/dev-runner.js", which open local server. The file is: gist.github.com/BorysTyminski/0dd37249b274c12796b030b565671564– BT101
Mar 16 at 8:52
whats the output of command - "lsof -i :9515" when the connection is refused?
– Rohit Dalal
Mar 16 at 8:56
whats the output of command - "lsof -i :9515" when the connection is refused?
– Rohit Dalal
Mar 16 at 8:56
Well I can't really run any command until I stop server with ctrl+C. Except that I'm using windows10. I don't know if command
lsof is recognized command in windows.– BT101
Mar 16 at 9:04
Well I can't really run any command until I stop server with ctrl+C. Except that I'm using windows10. I don't know if command
lsof is recognized command in windows.– BT101
Mar 16 at 9:04
My bad. Poweshell and cmd are both available to run commands. See stackoverflow.com/questions/48198/… for seeing whats running on your port
– Rohit Dalal
Mar 16 at 9:08
My bad. Poweshell and cmd are both available to run commands. See stackoverflow.com/questions/48198/… for seeing whats running on your port
– Rohit Dalal
Mar 16 at 9:08
|
show 5 more comments
1 Answer
1
active
oldest
votes
You have used the following capability:
capabilities.setPageLoadStrategy('eager');
Earlier, in a couple of QAs we have discussed about PageLoadStrategy as eager for ChromeDriver and Chrome:
- Page load strategy for Chrome driver (Updated till Selenium v3.12.0)
- “Eager” Page Load Strategy workaround for Chromedriver Selenium in Python
The conclusion was, as per WebDriver Status you will find the list of all WebDriver commands and their current support in ChromeDriver based on what is in the WebDriver Specification. Once the implementation are completed from all aspects PageLoadStrategy.EAGER is bound to be functionally present within Chrome Driver.
Similar discussions were also active on several threads within bugs.chromium.org and groups.google.com as follows:
- PageLoadStrategy.EAGER doesn't work with chromedriver
- Support eager page load strategy
- Implement page load timeout API
If you look at page_load_strategy.cc PageLoadStrategy as eager is yet to be implemented:
#include "chrome/test/chromedriver/chrome/page_load_strategy.h"
#include "base/logging.h"
#include "chrome/test/chromedriver/chrome/navigation_tracker.h"
#include "chrome/test/chromedriver/chrome/non_blocking_navigation_tracker.h"
const char PageLoadStrategy::kNormal[] = "normal";
const char PageLoadStrategy::kNone[] = "none";
const char PageLoadStrategy::kEager[] = "eager";
PageLoadStrategy* PageLoadStrategy::Create(
std::string strategy,
DevToolsClient* client,
const BrowserInfo* browser_info,
const JavaScriptDialogManager* dialog_manager)
if (strategy == kNone)
return new NonBlockingNavigationTracker();
else if (strategy == kNormal)
return new NavigationTracker(client, browser_info, dialog_manager);
else
NOTREACHED() << "invalid strategy '" << strategy << "'";
return nullptr;
This may be root cause of the Error: ECONNREFUSED which you are seeing as the dummy elements/iframes may not have generated/created/rendered completely as per the Chrome Browser startup logs:
[1517231304.270][DEBUG]: DEVTOOLS COMMAND Runtime.evaluate (id=11) {
"expression": "var isLoaded = document.readyState == 'complete' || document.readyState == 'interactive';if (isLoaded) var frame = document.createElement('iframe'); frame.name = 'chromedriver dummy frame'; ..."
This issue inturn causes the line:
webElement.getAttribute('style')
to cause the actual error.
Solution
For a cleaner test you may need to use PageLoadStrategy as normal instead as:
capabilities.setPageLoadStrategy('normal');
Outro
Some relevant discussions:
- How to fix python-selenium error “connection refused” when initializing a selenium webdriver?
- How to fix “WebDriverException: Message: connection refused”?
- ConnectionResetError: [Errno 104] Connection reset by peer and ERR_NAME_NOT_RESOLVED on heroku with mobile testing through Selenium
I don't know who -1 but this answer is correct. Eager is sometimes causing error. Anyway I switch to puppeteer because selenium makes some things hard - like changingwindow.navigator. Also I feel like puppeteer is performing better.
– BT101
Mar 24 at 13:26
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55194945%2fselenium-webdriver-error-econnrefused-connect-econnrefused-127-0-0-19515%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have used the following capability:
capabilities.setPageLoadStrategy('eager');
Earlier, in a couple of QAs we have discussed about PageLoadStrategy as eager for ChromeDriver and Chrome:
- Page load strategy for Chrome driver (Updated till Selenium v3.12.0)
- “Eager” Page Load Strategy workaround for Chromedriver Selenium in Python
The conclusion was, as per WebDriver Status you will find the list of all WebDriver commands and their current support in ChromeDriver based on what is in the WebDriver Specification. Once the implementation are completed from all aspects PageLoadStrategy.EAGER is bound to be functionally present within Chrome Driver.
Similar discussions were also active on several threads within bugs.chromium.org and groups.google.com as follows:
- PageLoadStrategy.EAGER doesn't work with chromedriver
- Support eager page load strategy
- Implement page load timeout API
If you look at page_load_strategy.cc PageLoadStrategy as eager is yet to be implemented:
#include "chrome/test/chromedriver/chrome/page_load_strategy.h"
#include "base/logging.h"
#include "chrome/test/chromedriver/chrome/navigation_tracker.h"
#include "chrome/test/chromedriver/chrome/non_blocking_navigation_tracker.h"
const char PageLoadStrategy::kNormal[] = "normal";
const char PageLoadStrategy::kNone[] = "none";
const char PageLoadStrategy::kEager[] = "eager";
PageLoadStrategy* PageLoadStrategy::Create(
std::string strategy,
DevToolsClient* client,
const BrowserInfo* browser_info,
const JavaScriptDialogManager* dialog_manager)
if (strategy == kNone)
return new NonBlockingNavigationTracker();
else if (strategy == kNormal)
return new NavigationTracker(client, browser_info, dialog_manager);
else
NOTREACHED() << "invalid strategy '" << strategy << "'";
return nullptr;
This may be root cause of the Error: ECONNREFUSED which you are seeing as the dummy elements/iframes may not have generated/created/rendered completely as per the Chrome Browser startup logs:
[1517231304.270][DEBUG]: DEVTOOLS COMMAND Runtime.evaluate (id=11) {
"expression": "var isLoaded = document.readyState == 'complete' || document.readyState == 'interactive';if (isLoaded) var frame = document.createElement('iframe'); frame.name = 'chromedriver dummy frame'; ..."
This issue inturn causes the line:
webElement.getAttribute('style')
to cause the actual error.
Solution
For a cleaner test you may need to use PageLoadStrategy as normal instead as:
capabilities.setPageLoadStrategy('normal');
Outro
Some relevant discussions:
- How to fix python-selenium error “connection refused” when initializing a selenium webdriver?
- How to fix “WebDriverException: Message: connection refused”?
- ConnectionResetError: [Errno 104] Connection reset by peer and ERR_NAME_NOT_RESOLVED on heroku with mobile testing through Selenium
I don't know who -1 but this answer is correct. Eager is sometimes causing error. Anyway I switch to puppeteer because selenium makes some things hard - like changingwindow.navigator. Also I feel like puppeteer is performing better.
– BT101
Mar 24 at 13:26
add a comment |
You have used the following capability:
capabilities.setPageLoadStrategy('eager');
Earlier, in a couple of QAs we have discussed about PageLoadStrategy as eager for ChromeDriver and Chrome:
- Page load strategy for Chrome driver (Updated till Selenium v3.12.0)
- “Eager” Page Load Strategy workaround for Chromedriver Selenium in Python
The conclusion was, as per WebDriver Status you will find the list of all WebDriver commands and their current support in ChromeDriver based on what is in the WebDriver Specification. Once the implementation are completed from all aspects PageLoadStrategy.EAGER is bound to be functionally present within Chrome Driver.
Similar discussions were also active on several threads within bugs.chromium.org and groups.google.com as follows:
- PageLoadStrategy.EAGER doesn't work with chromedriver
- Support eager page load strategy
- Implement page load timeout API
If you look at page_load_strategy.cc PageLoadStrategy as eager is yet to be implemented:
#include "chrome/test/chromedriver/chrome/page_load_strategy.h"
#include "base/logging.h"
#include "chrome/test/chromedriver/chrome/navigation_tracker.h"
#include "chrome/test/chromedriver/chrome/non_blocking_navigation_tracker.h"
const char PageLoadStrategy::kNormal[] = "normal";
const char PageLoadStrategy::kNone[] = "none";
const char PageLoadStrategy::kEager[] = "eager";
PageLoadStrategy* PageLoadStrategy::Create(
std::string strategy,
DevToolsClient* client,
const BrowserInfo* browser_info,
const JavaScriptDialogManager* dialog_manager)
if (strategy == kNone)
return new NonBlockingNavigationTracker();
else if (strategy == kNormal)
return new NavigationTracker(client, browser_info, dialog_manager);
else
NOTREACHED() << "invalid strategy '" << strategy << "'";
return nullptr;
This may be root cause of the Error: ECONNREFUSED which you are seeing as the dummy elements/iframes may not have generated/created/rendered completely as per the Chrome Browser startup logs:
[1517231304.270][DEBUG]: DEVTOOLS COMMAND Runtime.evaluate (id=11) {
"expression": "var isLoaded = document.readyState == 'complete' || document.readyState == 'interactive';if (isLoaded) var frame = document.createElement('iframe'); frame.name = 'chromedriver dummy frame'; ..."
This issue inturn causes the line:
webElement.getAttribute('style')
to cause the actual error.
Solution
For a cleaner test you may need to use PageLoadStrategy as normal instead as:
capabilities.setPageLoadStrategy('normal');
Outro
Some relevant discussions:
- How to fix python-selenium error “connection refused” when initializing a selenium webdriver?
- How to fix “WebDriverException: Message: connection refused”?
- ConnectionResetError: [Errno 104] Connection reset by peer and ERR_NAME_NOT_RESOLVED on heroku with mobile testing through Selenium
I don't know who -1 but this answer is correct. Eager is sometimes causing error. Anyway I switch to puppeteer because selenium makes some things hard - like changingwindow.navigator. Also I feel like puppeteer is performing better.
– BT101
Mar 24 at 13:26
add a comment |
You have used the following capability:
capabilities.setPageLoadStrategy('eager');
Earlier, in a couple of QAs we have discussed about PageLoadStrategy as eager for ChromeDriver and Chrome:
- Page load strategy for Chrome driver (Updated till Selenium v3.12.0)
- “Eager” Page Load Strategy workaround for Chromedriver Selenium in Python
The conclusion was, as per WebDriver Status you will find the list of all WebDriver commands and their current support in ChromeDriver based on what is in the WebDriver Specification. Once the implementation are completed from all aspects PageLoadStrategy.EAGER is bound to be functionally present within Chrome Driver.
Similar discussions were also active on several threads within bugs.chromium.org and groups.google.com as follows:
- PageLoadStrategy.EAGER doesn't work with chromedriver
- Support eager page load strategy
- Implement page load timeout API
If you look at page_load_strategy.cc PageLoadStrategy as eager is yet to be implemented:
#include "chrome/test/chromedriver/chrome/page_load_strategy.h"
#include "base/logging.h"
#include "chrome/test/chromedriver/chrome/navigation_tracker.h"
#include "chrome/test/chromedriver/chrome/non_blocking_navigation_tracker.h"
const char PageLoadStrategy::kNormal[] = "normal";
const char PageLoadStrategy::kNone[] = "none";
const char PageLoadStrategy::kEager[] = "eager";
PageLoadStrategy* PageLoadStrategy::Create(
std::string strategy,
DevToolsClient* client,
const BrowserInfo* browser_info,
const JavaScriptDialogManager* dialog_manager)
if (strategy == kNone)
return new NonBlockingNavigationTracker();
else if (strategy == kNormal)
return new NavigationTracker(client, browser_info, dialog_manager);
else
NOTREACHED() << "invalid strategy '" << strategy << "'";
return nullptr;
This may be root cause of the Error: ECONNREFUSED which you are seeing as the dummy elements/iframes may not have generated/created/rendered completely as per the Chrome Browser startup logs:
[1517231304.270][DEBUG]: DEVTOOLS COMMAND Runtime.evaluate (id=11) {
"expression": "var isLoaded = document.readyState == 'complete' || document.readyState == 'interactive';if (isLoaded) var frame = document.createElement('iframe'); frame.name = 'chromedriver dummy frame'; ..."
This issue inturn causes the line:
webElement.getAttribute('style')
to cause the actual error.
Solution
For a cleaner test you may need to use PageLoadStrategy as normal instead as:
capabilities.setPageLoadStrategy('normal');
Outro
Some relevant discussions:
- How to fix python-selenium error “connection refused” when initializing a selenium webdriver?
- How to fix “WebDriverException: Message: connection refused”?
- ConnectionResetError: [Errno 104] Connection reset by peer and ERR_NAME_NOT_RESOLVED on heroku with mobile testing through Selenium
You have used the following capability:
capabilities.setPageLoadStrategy('eager');
Earlier, in a couple of QAs we have discussed about PageLoadStrategy as eager for ChromeDriver and Chrome:
- Page load strategy for Chrome driver (Updated till Selenium v3.12.0)
- “Eager” Page Load Strategy workaround for Chromedriver Selenium in Python
The conclusion was, as per WebDriver Status you will find the list of all WebDriver commands and their current support in ChromeDriver based on what is in the WebDriver Specification. Once the implementation are completed from all aspects PageLoadStrategy.EAGER is bound to be functionally present within Chrome Driver.
Similar discussions were also active on several threads within bugs.chromium.org and groups.google.com as follows:
- PageLoadStrategy.EAGER doesn't work with chromedriver
- Support eager page load strategy
- Implement page load timeout API
If you look at page_load_strategy.cc PageLoadStrategy as eager is yet to be implemented:
#include "chrome/test/chromedriver/chrome/page_load_strategy.h"
#include "base/logging.h"
#include "chrome/test/chromedriver/chrome/navigation_tracker.h"
#include "chrome/test/chromedriver/chrome/non_blocking_navigation_tracker.h"
const char PageLoadStrategy::kNormal[] = "normal";
const char PageLoadStrategy::kNone[] = "none";
const char PageLoadStrategy::kEager[] = "eager";
PageLoadStrategy* PageLoadStrategy::Create(
std::string strategy,
DevToolsClient* client,
const BrowserInfo* browser_info,
const JavaScriptDialogManager* dialog_manager)
if (strategy == kNone)
return new NonBlockingNavigationTracker();
else if (strategy == kNormal)
return new NavigationTracker(client, browser_info, dialog_manager);
else
NOTREACHED() << "invalid strategy '" << strategy << "'";
return nullptr;
This may be root cause of the Error: ECONNREFUSED which you are seeing as the dummy elements/iframes may not have generated/created/rendered completely as per the Chrome Browser startup logs:
[1517231304.270][DEBUG]: DEVTOOLS COMMAND Runtime.evaluate (id=11) {
"expression": "var isLoaded = document.readyState == 'complete' || document.readyState == 'interactive';if (isLoaded) var frame = document.createElement('iframe'); frame.name = 'chromedriver dummy frame'; ..."
This issue inturn causes the line:
webElement.getAttribute('style')
to cause the actual error.
Solution
For a cleaner test you may need to use PageLoadStrategy as normal instead as:
capabilities.setPageLoadStrategy('normal');
Outro
Some relevant discussions:
- How to fix python-selenium error “connection refused” when initializing a selenium webdriver?
- How to fix “WebDriverException: Message: connection refused”?
- ConnectionResetError: [Errno 104] Connection reset by peer and ERR_NAME_NOT_RESOLVED on heroku with mobile testing through Selenium
answered Mar 22 at 16:35
DebanjanBDebanjanB
46.4k134790
46.4k134790
I don't know who -1 but this answer is correct. Eager is sometimes causing error. Anyway I switch to puppeteer because selenium makes some things hard - like changingwindow.navigator. Also I feel like puppeteer is performing better.
– BT101
Mar 24 at 13:26
add a comment |
I don't know who -1 but this answer is correct. Eager is sometimes causing error. Anyway I switch to puppeteer because selenium makes some things hard - like changingwindow.navigator. Also I feel like puppeteer is performing better.
– BT101
Mar 24 at 13:26
I don't know who -1 but this answer is correct. Eager is sometimes causing error. Anyway I switch to puppeteer because selenium makes some things hard - like changing
window.navigator. Also I feel like puppeteer is performing better.– BT101
Mar 24 at 13:26
I don't know who -1 but this answer is correct. Eager is sometimes causing error. Anyway I switch to puppeteer because selenium makes some things hard - like changing
window.navigator. Also I feel like puppeteer is performing better.– BT101
Mar 24 at 13:26
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55194945%2fselenium-webdriver-error-econnrefused-connect-econnrefused-127-0-0-19515%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Where is your server hosted?
– Rohit Dalal
Mar 16 at 8:46
I'm runing code locally. I've created my electron app using electron-vue cli boilerplate.
npm run devwhich I call from terminal is runing script"dev": "node .electron-vue/dev-runner.js",which open local server. The file is: gist.github.com/BorysTyminski/0dd37249b274c12796b030b565671564– BT101
Mar 16 at 8:52
whats the output of command - "lsof -i :9515" when the connection is refused?
– Rohit Dalal
Mar 16 at 8:56
Well I can't really run any command until I stop server with ctrl+C. Except that I'm using windows10. I don't know if command
lsofis recognized command in windows.– BT101
Mar 16 at 9:04
My bad. Poweshell and cmd are both available to run commands. See stackoverflow.com/questions/48198/… for seeing whats running on your port
– Rohit Dalal
Mar 16 at 9:08