ECONNREFUSED when element not found

Open
#3,847 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
30/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, node.js

Research direction

Start by running the attached trial_journey_issue.txt script against the reported site and compare the first failed iteration with the second. Read browsertime/lib/core/engine/command/click.js, browsertime/lib/core/engine/iteration.js, and browsertime/lib/core/engine/run.js around the reported call paths. Done means the missing-element failure is handled consistently and later iterations do not terminate with ECONNREFUSED.

Written by the indexing model from the issue text.

Description

bug windows
Have you read the documentation?
URL

https://demoqa.com/

What are you trying to accomplish

I am experiencing an issue while running a scripted journey in which it is attempting to perform an operation on a 'not found element.' I have tried running the journey for 3 iterations. The scripted journey has 2 measurements, one for launch and the other for clicking where the element is not found.

The first iteration failed with an error indicating that the element was not found. The journey continued to the second iteration, but it failed immediately after launching the second iteration(even measurement for launch didn't happen). I have provided the version used and the specific error that was reported below. Additionally, I have attached the script for your reference.
trial_journey_issue.txt

INFO: Versions OS: win32 10.0.14393 nodejs: v16.15.0 sitespeed.io: 25.7.3 browsertime: ^16.13.3 coach: 7.1.2

Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:51177
at ClientRequest. (C:\SitespeedioMain\sitespeed.io-main\node_modules\selenium-webdriver\http\index.js:294:15)
at ClientRequest.emit (node:events:527:28)
at Socket.socketErrorListener (node:_http_client:454:9)
at Socket.emit (node:events:527:28)
at emitErrorNT (node:internal/streams/destroy:157:8)
at emitErrorCloseNT (node:internal/streams/destroy:122:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21)

What browser did you use?

Chrome

How to reproduce
Please use the attached script to reproduce
Relevant log output
[2023-05-17 03:18:29] INFO: Versions OS: win32 10.0.14393 nodejs: v16.15.0 sitespeed.io: 25.7.3 browsertime: ^16.13.3 coach: 7.1.2
[2023-05-17 03:18:33] INFO: Running tests using Chrome - 3 iteration(s)

DevTools listening on ws://127.0.0.1:9222/devtools/browser/9b5ba524-446a-4a00-a75e-d626245b4809
[2112:2188:0517/031837.023:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP cache.pack.google.com 127.0.0.1"
[2112:2188:0517/031837.023:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP clients1.google.com 127.0.0.1"
[2112:2188:0517/031837.023:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP update.googleapis.com 127.0.0.1"
[2112:2188:0517/031837.023:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP redirector.gvt1.com 127.0.0.1"
[2112:2188:0517/031837.023:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP laptop-updates.brave.com 127.0.0.1"
[2112:2188:0517/031837.023:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP offlinepages-pa.googleapis.com 127.0.0.1"
[2112:2188:0517/031837.023:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP edge.microsoft.com 127.0.0.1"
[2112:2188:0517/031837.023:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP optimizationguide-pa.googleapis.com 127.0.0.1"
[2112:2188:0517/031837.315:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP cache.pack.google.com 127.0.0.1"
[2112:2188:0517/031837.374:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP clients1.google.com 127.0.0.1"
[2112:2188:0517/031837.396:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP update.googleapis.com 127.0.0.1"
[2112:2188:0517/031837.407:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP redirector.gvt1.com 127.0.0.1"
[2112:2188:0517/031837.412:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP laptop-updates.brave.com 127.0.0.1"
[2112:2188:0517/031837.414:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP offlinepages-pa.googleapis.com 127.0.0.1"
[2112:2188:0517/031837.416:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP edge.microsoft.com 127.0.0.1"
[2112:2188:0517/031837.416:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP optimizationguide-pa.googleapis.com 127.0.0.1"
[2023-05-17 03:18:37] INFO: Start to measure homepage_trial
[2023-05-17 03:18:37] INFO: Navigating to url https://www.dummy.com/ iteration 1
[2023-05-17 03:18:47] INFO: Take after page complete check screenshot
[2023-05-17 03:18:49] INFO: Take cumulative layout shift screenshot
[2023-05-17 03:18:51] INFO: Take largest contentful paint screenshot
[2023-05-17 03:18:55] INFO: Start to measure click_on_accept_button
[2023-05-17 03:18:55] ERROR: Couldn't execute script named CUSTOM error:JavascriptError: javascript error: Cannot read properties of null (reading 'click')
  (Session info: chrome=113.0.5672.94)
[2023-05-17 03:18:55] ERROR: Could not find element by xpath //*[@id="onetrust-accept-btns-handlers"]
[2023-05-17 03:18:55] ERROR: Error: Could not find element by xpath //*[@id="onetrust-accept-btns-handlers"]
    at Click.byXpathAndWait (C:\SitespeedioMain\sitespeed.io-main\node_modules\browsertime\lib\core\engine\command\click.js:159:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async module.exports (C:\Sitespeedio\sitespeed-script\1.js:20:4)
    at async C:\SitespeedioMain\sitespeed.io-main\node_modules\browsertime\lib\core\engine\run.js:7:9
    at async Iteration.run (C:\SitespeedioMain\sitespeed.io-main\node_modules\browsertime\lib\core\engine\iteration.js:223:9)
    at async Engine.runByScript (C:\SitespeedioMain\sitespeed.io-main\node_modules\browsertime\lib\core\engine\index.js:270:20)
    at async Object.analyzeUrl (C:\SitespeedioMain\sitespeed.io-main\lib\plugins\browsertime\analyzer.js:171:21)
    at async Object.processMessage (C:\SitespeedioMain\sitespeed.io-main\lib\plugins\browsertime\index.js:150:26)
[2023-05-17 03:18:55] INFO: https://www.dummy.com/ TTFB: 475ms DOMContentLoaded: 1.59s firstPaint: 1.28s FCP: 1.28s LCP: 1.28s Load: 2.91s TBT: 173ms CLS:0.0004
[2023-05-17 03:18:56] INFO: C:\Sitespeedio\sitespeed-script\1.js

DevTools listening on ws://127.0.0.1:9222/devtools/browser/0245ce8e-8b5c-4b2b-a35f-9d92227d64e9
[3232:3108:0517/031856.784:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP cache.pack.google.com 127.0.0.1"
[3232:3108:0517/031856.784:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP clients1.google.com 127.0.0.1"
[3232:3108:0517/031856.799:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP update.googleapis.com 127.0.0.1"
[3232:3108:0517/031856.799:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP redirector.gvt1.com 127.0.0.1"
[3232:3108:0517/031856.830:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP laptop-updates.brave.com 127.0.0.1"
[3232:3108:0517/031856.846:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP offlinepages-pa.googleapis.com 127.0.0.1"
[3232:3108:0517/031856.846:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP edge.microsoft.com 127.0.0.1"
[3232:3108:0517/031856.846:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP optimizationguide-pa.googleapis.com 127.0.0.1"
[3232:3108:0517/031857.004:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP cache.pack.google.com 127.0.0.1"
[3232:3108:0517/031857.039:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP clients1.google.com 127.0.0.1"
[3232:3108:0517/031857.094:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP update.googleapis.com 127.0.0.1"
[3232:3108:0517/031857.149:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP redirector.gvt1.com 127.0.0.1"
[3232:3108:0517/031857.150:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP laptop-updates.brave.com 127.0.0.1"
[3232:3108:0517/031857.161:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP offlinepages-pa.googleapis.com 127.0.0.1"
[3232:3108:0517/031857.164:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP edge.microsoft.com 127.0.0.1"
[3232:3108:0517/031857.165:ERROR:host_mapping_rules.cc(146)] Failed parsing rule: "MAP optimizationguide-pa.googleapis.com 127.0.0.1"
[2023-05-17 03:18:57] INFO: Start to measure homepage_trial
[2023-05-17 03:18:57] INFO: Navigating to url https://www.dummy.com/ iteration 2
C:\SitespeedioMain\sitespeed.io-main\node_modules\selenium-webdriver\http\index.js:294
      onError(new Error(message))
              ^

Error: ECONNREFUSED connect ECONNREFUSED 127.0.0.1:51177
    at ClientRequest.<anonymous> (C:\SitespeedioMain\sitespeed.io-main\node_modules\selenium-webdriver\http\index.js:294:15)
    at ClientRequest.emit (node:events:527:28)
    at Socket.socketErrorListener (node:_http_client:454:9)
    at Socket.emit (node:events:527:28)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
Dominant language
JavaScript
Stars
5k
Forks
624
Avg merge
4h 8m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sitespeedio/sitespeed.io

All issues in sitespeedio/sitespeed.io

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.