Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js] Add service example #1848

Merged
merged 2 commits into from
Aug 12, 2024
Merged

[js] Add service example #1848

merged 2 commits into from
Aug 12, 2024

Conversation

pujagani
Copy link
Contributor

@pujagani pujagani commented Aug 9, 2024

User description

Thanks for contributing to the Selenium site and documentation!
A PR well described will help maintainers to review and merge it quickly

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, and help reviewers by making them as simple and short as possible.

Description

Add code examples, especially since the Selenium Manager links to a code snippet to use service for certain architectures that are not supported by Selenium Manager.

Motivation and Context

Types of changes

  • Change to the site (I have double-checked the Netlify deployment, and my changes look good)
  • Code example added (and I also added the example to all translated languages)
  • Improved translation
  • Added new translation (and I also added a notice to each document missing translation)

Checklist

  • I have read the contributing document.
  • I have used hugo to render the site/docs locally and I am sure it works.

PR Type

Tests


Description

  • Added a new test file service.spec.js under examples/javascript/test/drivers/.
  • Implemented three test cases demonstrating the use of Chrome service in Selenium WebDriver:
    • Default service configuration.
    • Setting custom driver and browser binary locations.
    • Configuring a custom port for the service.
  • Utilized selenium-webdriver library to build and manage the Chrome driver instances.

Changes walkthrough 📝

Relevant files
Tests
service.spec.js
Add Chrome service example tests in JavaScript                     

examples/javascript/test/drivers/service.spec.js

  • Added a new test file for Chrome service examples.
  • Implemented three test cases: default service, setting driver
    location, and setting port.
  • Utilized selenium-webdriver library for browser automation.
  • +53/-0   

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link
    Contributor

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    Missing Initialization
    The service variable is used but not properly initialized in the 'Default service' test case. This might lead to runtime errors or unexpected behavior.

    Duplicate Variable Declaration
    The options variable is redeclared in the 'Set Driver Location' test case, which can lead to confusion and potential bugs. Consider renaming or reusing the existing variable.

    Copy link
    Contributor

    codiumai-pr-agent-pro bot commented Aug 9, 2024

    CI Failure Feedback 🧐

    (Checks updated until commit cc00794)

    Action: tests (windows, stable)

    Failed stage: Run tests [❌]

    Failed test name: test navigate and listen to errors

    Failure summary:

    The action failed due to multiple test failures, primarily caused by unexpected server responses and
    session issues:

  • test navigate and listen to errors failed with Uncaught Error: Unexpected server response: 404
  • test create a browsing context for given id failed with Uncaught Error: Unexpected server response:
    404
  • can listen to window browsing context created event failed with Uncaught Error: Unexpected server
    response: 404
  • can perform input action failed with NoSuchSessionError: Tried to run command without establishing a
    connection
  • can execute release in browsing context failed with NoSuchSessionError: Tried to run command without
    establishing a connection
  • Set Driver Location failed with Error: Timed out waiting for the WebDriver server

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Microsoft Windows Server 2022
    ...
    
    217:  timeout_minutes: 20
    218:  max_attempts: 3
    219:  command: cd examples/javascript
    220:  npm test
    221:  
    222:  retry_wait_seconds: 10
    223:  polling_interval_seconds: 1
    224:  warning_on_retry: true
    225:  continue_on_error: false
    ...
    
    268:  ✔ Scroll to the element (678ms)
    269:  Actions API - Wheel Tests
    270:  ✔ Scroll to element (483ms)
    271:  ✔ Scroll by given amount (579ms)
    272:  ✔ Scroll from an element by a given amount (612ms)
    273:  ✔ Scroll from an element with an offset (620ms)
    274:  ✔ Scroll from an offset of origin (element) by given amount (1123ms)
    275:  Integration Tests
    276:  4) test navigate and listen to errors
    ...
    
    303:  - can locate node with none ownership value
    304:  - can locate node with root ownership value
    305:  - can locate node with given start nodes
    306:  - can locate nodes in a given sandbox
    307:  - can find element
    308:  - can find elements
    309:  Log Inspector
    310:  18) test listen to console log
    311:  ✔ test listen to javascript error log (7927ms)
    ...
    
    347:  35) "after each" hook for "can disown handles in realm"
    348:  Script events
    349:  36) can listen to channel message
    350:  37) can listen to realm created message
    351:  - can listen to realm destroyed message
    352:  BiDi Logging
    353:  38) can listen to console log
    354:  ✔ can remove console log handler (8501ms)
    355:  ✔ can listen to javascript error (8037ms)
    356:  39) can remove to javascript error handler
    ...
    
    493:  }
    494:  ]
    495:  ✔ Delete a cookie (59ms)
    496:  ✔ Delete all cookies (279ms)
    497:  Interactions
    498:  ✔ Should be able to get title and current url (4890ms)
    499:  Interactions - Navigation
    500:  ✔ Browser navigation test (5780ms)
    501:  ##[warning]Attempt 1 failed. Reason: Timeout of 1200000ms hit
    ...
    
    536:  ✔ Scroll to the element (3537ms)
    537:  Actions API - Wheel Tests
    538:  ✔ Scroll to element (2425ms)
    539:  ✔ Scroll by given amount (571ms)
    540:  ✔ Scroll from an element by a given amount (601ms)
    541:  ✔ Scroll from an element with an offset (616ms)
    542:  ✔ Scroll from an offset of origin (element) by given amount (1080ms)
    543:  Integration Tests
    544:  1) test navigate and listen to errors
    ...
    
    571:  - can locate node with none ownership value
    572:  - can locate node with root ownership value
    573:  - can locate node with given start nodes
    574:  - can locate nodes in a given sandbox
    575:  - can find element
    576:  - can find elements
    577:  Log Inspector
    578:  15) test listen to console log
    579:  16) test listen to javascript error log
    ...
    
    615:  43) "after each" hook for "can disown handles in realm"
    616:  Script events
    617:  44) can listen to channel message
    618:  45) can listen to realm created message
    619:  - can listen to realm destroyed message
    620:  BiDi Logging
    621:  ✔ can listen to console log (6594ms)
    622:  46) can remove console log handler
    623:  ✔ can listen to javascript error (8237ms)
    624:  ✔ can remove to javascript error handler (7366ms)
    ...
    
    786:  ✔ Create and add non residential key
    787:  ✔ Get credential
    788:  ✔ Remove all credentials
    789:  ✔ Set is user verified
    790:  Virtual authenticator options
    791:  ✔ Virtual options
    792:  ✔ User verified
    793:  Waits
    794:  ✔ fail (1792ms)
    795:  ✔ sleep (2260ms)
    796:  ✔ implicit (1097ms)
    797:  ✔ explicit (1227ms)
    798:  99 passing (20m)
    799:  20 pending
    800:  51 failing
    801:  1) Integration Tests
    802:  test navigate and listen to errors:
    803:  Uncaught Error: Unexpected server response: 404
    ...
    
    808:  at Socket.socketOnData (node:_http_client:541:22)
    809:  at Socket.emit (node:events:517:28)
    810:  at addChunk (node:internal/streams/readable:368:12)
    811:  at readableAddChunk (node:internal/streams/readable:341:9)
    812:  at Readable.push (node:internal/streams/readable:278:10)
    813:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    814:  2) Browsing Context
    815:  "after each" hook for "test create a browsing context for given id":
    816:  Uncaught Error: Unexpected server response: 404
    ...
    
    821:  at Socket.socketOnData (node:_http_client:541:22)
    822:  at Socket.emit (node:events:517:28)
    823:  at addChunk (node:internal/streams/readable:368:12)
    824:  at readableAddChunk (node:internal/streams/readable:341:9)
    825:  at Readable.push (node:internal/streams/readable:278:10)
    826:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    827:  3) Browsing Context
    828:  "after each" hook for "test create a browsing context for given id":
    829:  Error: done() called multiple times in hook <Browsing Context "after each" hook for "test create a browsing context for given id"> of file D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\browsingContext.spec.js
    830:  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    831:  4) Browsing Context Inspector
    832:  can listen to window browsing context created event:
    833:  Uncaught Error: Unexpected server response: 404
    ...
    
    838:  at Socket.socketOnData (node:_http_client:541:22)
    839:  at Socket.emit (node:events:517:28)
    840:  at addChunk (node:internal/streams/readable:368:12)
    841:  at readableAddChunk (node:internal/streams/readable:341:9)
    842:  at Readable.push (node:internal/streams/readable:278:10)
    843:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    844:  5) Browsing Context Inspector
    845:  can listen to tab browsing context created event:
    846:  Uncaught Error: Unexpected server response: 404
    ...
    
    851:  at Socket.socketOnData (node:_http_client:541:22)
    852:  at Socket.emit (node:events:517:28)
    853:  at addChunk (node:internal/streams/readable:368:12)
    854:  at readableAddChunk (node:internal/streams/readable:341:9)
    855:  at Readable.push (node:internal/streams/readable:278:10)
    856:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    857:  6) Browsing Context Inspector
    858:  can listen to dom content loaded event:
    859:  Uncaught Error: Unexpected server response: 404
    ...
    
    864:  at Socket.socketOnData (node:_http_client:541:22)
    865:  at Socket.emit (node:events:517:28)
    866:  at addChunk (node:internal/streams/readable:368:12)
    867:  at readableAddChunk (node:internal/streams/readable:341:9)
    868:  at Readable.push (node:internal/streams/readable:278:10)
    869:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    870:  7) Browsing Context Inspector
    871:  can listen to browsing context loaded event:
    872:  Uncaught Error: Unexpected server response: 404
    ...
    
    877:  at Socket.socketOnData (node:_http_client:541:22)
    878:  at Socket.emit (node:events:517:28)
    879:  at addChunk (node:internal/streams/readable:368:12)
    880:  at readableAddChunk (node:internal/streams/readable:341:9)
    881:  at Readable.push (node:internal/streams/readable:278:10)
    882:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    883:  8) Browsing Context Inspector
    884:  can listen to fragment navigated event:
    885:  Uncaught Error: Unexpected server response: 404
    ...
    
    890:  at Socket.socketOnData (node:_http_client:541:22)
    891:  at Socket.emit (node:events:517:28)
    892:  at addChunk (node:internal/streams/readable:368:12)
    893:  at readableAddChunk (node:internal/streams/readable:341:9)
    894:  at Readable.push (node:internal/streams/readable:278:10)
    895:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    896:  9) Browsing Context Inspector
    897:  "after each" hook for "can listen to fragment navigated event":
    898:  Uncaught Error: Unexpected server response: 404
    ...
    
    903:  at Socket.socketOnData (node:_http_client:541:22)
    904:  at Socket.emit (node:events:517:28)
    905:  at addChunk (node:internal/streams/readable:368:12)
    906:  at readableAddChunk (node:internal/streams/readable:341:9)
    907:  at Readable.push (node:internal/streams/readable:278:10)
    908:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    909:  10) Browsing Context Inspector
    910:  "after each" hook for "can listen to fragment navigated event":
    911:  Error: done() called multiple times in hook <Browsing Context Inspector "after each" hook for "can listen to fragment navigated event"> of file D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\browsingContextInspector.spec.js
    912:  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    913:  11) Input module
    914:  can perform input action:
    915:  Uncaught Error: Unexpected server response: 404
    ...
    
    920:  at Socket.socketOnData (node:_http_client:541:22)
    921:  at Socket.emit (node:events:517:28)
    922:  at addChunk (node:internal/streams/readable:368:12)
    923:  at readableAddChunk (node:internal/streams/readable:341:9)
    924:  at Readable.push (node:internal/streams/readable:278:10)
    925:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    926:  12) Input module
    927:  can perform input action:
    928:  done() called multiple times in test <Input module can perform input action> of file D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\input.spec.js; in addition, done() received error: NoSuchSessionError: Tried to run command without establishing a connection
    929:  at Object.throwDecodedError (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\node_modules\selenium-webdriver\lib\error.js:521:15)
    930:  at parseHttpResponse (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\node_modules\selenium-webdriver\lib\http.js:514:13)
    931:  at Executor.execute (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\node_modules\selenium-webdriver\lib\http.js:446:28)
    932:  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    933:  at async thenableWebDriverProxy.execute (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\node_modules\selenium-webdriver\lib\webdriver.js:742:17)
    934:  at async thenableWebDriverProxy.findElements (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\node_modules\selenium-webdriver\lib\webdriver.js:1057:17)
    935:  at async Context.<anonymous> (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\input.spec.js:25:19) {
    936:  remoteStacktrace: ''
    937:  }
    938:  Error: done() called multiple times in test <Input module can perform input action> of file D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\input.spec.js; in addition, done() received error: NoSuchSessionError: Tried to run command without establishing a connection
    939:  at Object.throwDecodedError (node_modules\selenium-webdriver\lib\error.js:521:15)
    ...
    
    943:  at async thenableWebDriverProxy.execute (node_modules\selenium-webdriver\lib\webdriver.js:742:17)
    944:  at async thenableWebDriverProxy.findElements (node_modules\selenium-webdriver\lib\webdriver.js:1057:17)
    945:  at async Context.<anonymous> (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\input.spec.js:25:19) {
    946:  remoteStacktrace: ''
    947:  }
    948:  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    949:  13) Input module
    950:  can execute release in browsing context:
    951:  Uncaught Error: Unexpected server response: 404
    ...
    
    956:  at Socket.socketOnData (node:_http_client:541:22)
    957:  at Socket.emit (node:events:517:28)
    958:  at addChunk (node:internal/streams/readable:368:12)
    959:  at readableAddChunk (node:internal/streams/readable:341:9)
    960:  at Readable.push (node:internal/streams/readable:278:10)
    961:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    962:  14) Input module
    963:  can execute release in browsing context:
    964:  done() called multiple times in test <Input module can execute release in browsing context> of file D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\input.spec.js; in addition, done() received error: NoSuchSessionError: Tried to run command without establishing a connection
    965:  at Object.throwDecodedError (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\node_modules\selenium-webdriver\lib\error.js:521:15)
    966:  at parseHttpResponse (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\node_modules\selenium-webdriver\lib\http.js:514:13)
    967:  at Executor.execute (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\node_modules\selenium-webdriver\lib\http.js:446:28)
    968:  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    969:  at async thenableWebDriverProxy.execute (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\node_modules\selenium-webdriver\lib\webdriver.js:742:17)
    970:  at async Context.<anonymous> (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\input.spec.js:45:24) {
    971:  remoteStacktrace: ''
    972:  }
    973:  Error: done() called multiple times in test <Input module can execute release in browsing context> of file D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\input.spec.js; in addition, done() received error: NoSuchSessionError: Tried to run command without establishing a connection
    974:  at Object.throwDecodedError (node_modules\selenium-webdriver\lib\error.js:521:15)
    ...
    
    977:  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    978:  at async thenableWebDriverProxy.execute (node_modules\selenium-webdriver\lib\webdriver.js:742:17)
    979:  at async Context.<anonymous> (D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\input.spec.js:45:24) {
    980:  remoteStacktrace: ''
    981:  }
    982:  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    983:  15) Log Inspector
    984:  test listen to console log:
    985:  Uncaught Error: Unexpected server response: 404
    ...
    
    989:  at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
    990:  at Socket.socketOnData (node:_http_client:541:22)
    991:  at Socket.emit (node:events:517:28)
    992:  at addChunk (node:internal/streams/readable:368:12)
    993:  at readableAddChunk (node:internal/streams/readable:341:9)
    994:  at Readable.push (node:internal/streams/readable:278:10)
    995:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    996:  16) Log Inspector
    997:  test listen to javascript error log:
    998:  Uncaught Error: Unexpected server response: 404
    ...
    
    1003:  at Socket.socketOnData (node:_http_client:541:22)
    1004:  at Socket.emit (node:events:517:28)
    1005:  at addChunk (node:internal/streams/readable:368:12)
    1006:  at readableAddChunk (node:internal/streams/readable:341:9)
    1007:  at Readable.push (node:internal/streams/readable:278:10)
    1008:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1009:  17) Log Inspector
    1010:  test retrieve stack trace for a log:
    1011:  Uncaught Error: Unexpected server response: 404
    ...
    
    1016:  at Socket.socketOnData (node:_http_client:541:22)
    1017:  at Socket.emit (node:events:517:28)
    1018:  at addChunk (node:internal/streams/readable:368:12)
    1019:  at readableAddChunk (node:internal/streams/readable:341:9)
    1020:  at Readable.push (node:internal/streams/readable:278:10)
    1021:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1022:  18) Log Inspector
    1023:  test listen to logs with multiple consumers:
    1024:  Uncaught Error: Unexpected server response: 404
    ...
    
    1029:  at Socket.socketOnData (node:_http_client:541:22)
    1030:  at Socket.emit (node:events:517:28)
    1031:  at addChunk (node:internal/streams/readable:368:12)
    1032:  at readableAddChunk (node:internal/streams/readable:341:9)
    1033:  at Readable.push (node:internal/streams/readable:278:10)
    1034:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1035:  19) Network events
    1036:  can listen to event before request is sent:
    1037:  Uncaught Error: Unexpected server response: 404
    ...
    
    1042:  at Socket.socketOnData (node:_http_client:541:22)
    1043:  at Socket.emit (node:events:517:28)
    1044:  at addChunk (node:internal/streams/readable:368:12)
    1045:  at readableAddChunk (node:internal/streams/readable:341:9)
    1046:  at Readable.push (node:internal/streams/readable:278:10)
    1047:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1048:  20) Network events
    1049:  can request cookies:
    1050:  Uncaught Error: Unexpected server response: 404
    ...
    
    1055:  at Socket.socketOnData (node:_http_client:541:22)
    1056:  at Socket.emit (node:events:517:28)
    1057:  at addChunk (node:internal/streams/readable:368:12)
    1058:  at readableAddChunk (node:internal/streams/readable:341:9)
    1059:  at Readable.push (node:internal/streams/readable:278:10)
    1060:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1061:  21) Network events
    1062:  can redirect http equiv:
    1063:  Uncaught Error: Unexpected server response: 404
    ...
    
    1068:  at Socket.socketOnData (node:_http_client:541:22)
    1069:  at Socket.emit (node:events:517:28)
    1070:  at addChunk (node:internal/streams/readable:368:12)
    1071:  at readableAddChunk (node:internal/streams/readable:341:9)
    1072:  at Readable.push (node:internal/streams/readable:278:10)
    1073:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1074:  22) Network events
    1075:  can subscribe to response started:
    1076:  Uncaught Error: Unexpected server response: 404
    ...
    
    1081:  at Socket.socketOnData (node:_http_client:541:22)
    1082:  at Socket.emit (node:events:517:28)
    1083:  at addChunk (node:internal/streams/readable:368:12)
    1084:  at readableAddChunk (node:internal/streams/readable:341:9)
    1085:  at Readable.push (node:internal/streams/readable:278:10)
    1086:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1087:  23) Network events
    1088:  can subscribe to response completed:
    1089:  Uncaught Error: Unexpected server response: 404
    ...
    
    1094:  at Socket.socketOnData (node:_http_client:541:22)
    1095:  at Socket.emit (node:events:517:28)
    1096:  at addChunk (node:internal/streams/readable:368:12)
    1097:  at readableAddChunk (node:internal/streams/readable:341:9)
    1098:  at Readable.push (node:internal/streams/readable:278:10)
    1099:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1100:  24) Script commands
    1101:  can call function:
    1102:  Uncaught Error: Unexpected server response: 404
    ...
    
    1107:  at Socket.socketOnData (node:_http_client:541:22)
    1108:  at Socket.emit (node:events:517:28)
    1109:  at addChunk (node:internal/streams/readable:368:12)
    1110:  at readableAddChunk (node:internal/streams/readable:341:9)
    1111:  at Readable.push (node:internal/streams/readable:278:10)
    1112:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1113:  25) Script commands
    1114:  can call function with declaration:
    1115:  Uncaught Error: Unexpected server response: 404
    ...
    
    1120:  at Socket.socketOnData (node:_http_client:541:22)
    1121:  at Socket.emit (node:events:517:28)
    1122:  at addChunk (node:internal/streams/readable:368:12)
    1123:  at readableAddChunk (node:internal/streams/readable:341:9)
    1124:  at Readable.push (node:internal/streams/readable:278:10)
    1125:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1126:  26) Script commands
    1127:  can call function to get element:
    1128:  Uncaught Error: Unexpected server response: 404
    ...
    
    1133:  at Socket.socketOnData (node:_http_client:541:22)
    1134:  at Socket.emit (node:events:517:28)
    1135:  at addChunk (node:internal/streams/readable:368:12)
    1136:  at readableAddChunk (node:internal/streams/readable:341:9)
    1137:  at Readable.push (node:internal/streams/readable:278:10)
    1138:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1139:  27) Script commands
    1140:  can call function with arguments:
    1141:  Uncaught Error: Unexpected server response: 404
    ...
    
    1146:  at Socket.socketOnData (node:_http_client:541:22)
    1147:  at Socket.emit (node:events:517:28)
    1148:  at addChunk (node:internal/streams/readable:368:12)
    1149:  at readableAddChunk (node:internal/streams/readable:341:9)
    1150:  at Readable.push (node:internal/streams/readable:278:10)
    1151:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1152:  28) Script commands
    1153:  can call function with await promise:
    1154:  Uncaught Error: Unexpected server response: 404
    ...
    
    1159:  at Socket.socketOnData (node:_http_client:541:22)
    1160:  at Socket.emit (node:events:517:28)
    1161:  at addChunk (node:internal/streams/readable:368:12)
    1162:  at readableAddChunk (node:internal/streams/readable:341:9)
    1163:  at Readable.push (node:internal/streams/readable:278:10)
    1164:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1165:  29) Script commands
    1166:  can call function with await promise false:
    1167:  Uncaught Error: Unexpected server response: 404
    ...
    
    1172:  at Socket.socketOnData (node:_http_client:541:22)
    1173:  at Socket.emit (node:events:517:28)
    1174:  at addChunk (node:internal/streams/readable:368:12)
    1175:  at readableAddChunk (node:internal/streams/readable:341:9)
    1176:  at Readable.push (node:internal/streams/readable:278:10)
    1177:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1178:  30) Script commands
    1179:  can call function with this parameter:
    1180:  Uncaught Error: Unexpected server response: 404
    ...
    
    1185:  at Socket.socketOnData (node:_http_client:541:22)
    1186:  at Socket.emit (node:events:517:28)
    1187:  at addChunk (node:internal/streams/readable:368:12)
    1188:  at readableAddChunk (node:internal/streams/readable:341:9)
    1189:  at Readable.push (node:internal/streams/readable:278:10)
    1190:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1191:  31) Script commands
    1192:  can call function with ownership root:
    1193:  Uncaught Error: Unexpected server response: 404
    ...
    
    1198:  at Socket.socketOnData (node:_http_client:541:22)
    1199:  at Socket.emit (node:events:517:28)
    1200:  at addChunk (node:internal/streams/readable:368:12)
    1201:  at readableAddChunk (node:internal/streams/readable:341:9)
    1202:  at Readable.push (node:internal/streams/readable:278:10)
    1203:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1204:  32) Script commands
    1205:  can call function with ownership none:
    1206:  Uncaught Error: Unexpected server response: 404
    ...
    
    1211:  at Socket.socketOnData (node:_http_client:541:22)
    1212:  at Socket.emit (node:events:517:28)
    1213:  at addChunk (node:internal/streams/readable:368:12)
    1214:  at readableAddChunk (node:internal/streams/readable:341:9)
    1215:  at Readable.push (node:internal/streams/readable:278:10)
    1216:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1217:  33) Script commands
    1218:  can call function that throws exception:
    1219:  Uncaught Error: Unexpected server response: 404
    ...
    
    1224:  at Socket.socketOnData (node:_http_client:541:22)
    1225:  at Socket.emit (node:events:517:28)
    1226:  at addChunk (node:internal/streams/readable:368:12)
    1227:  at readableAddChunk (node:internal/streams/readable:341:9)
    1228:  at Readable.push (node:internal/streams/readable:278:10)
    1229:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1230:  34) Script commands
    1231:  can call function in a realm:
    1232:  Uncaught Error: Unexpected server response: 404
    ...
    
    1237:  at Socket.socketOnData (node:_http_client:541:22)
    1238:  at Socket.emit (node:events:517:28)
    1239:  at addChunk (node:internal/streams/readable:368:12)
    1240:  at readableAddChunk (node:internal/streams/readable:341:9)
    1241:  at Readable.push (node:internal/streams/readable:278:10)
    1242:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1243:  35) Script commands
    1244:  can evaluate script:
    1245:  Uncaught Error: Unexpected server response: 404
    ...
    
    1250:  at Socket.socketOnData (node:_http_client:541:22)
    1251:  at Socket.emit (node:events:517:28)
    1252:  at addChunk (node:internal/streams/readable:368:12)
    1253:  at readableAddChunk (node:internal/streams/readable:341:9)
    1254:  at Readable.push (node:internal/streams/readable:278:10)
    1255:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1256:  36) Script commands
    1257:  can evaluate script that throws exception:
    1258:  Uncaught Error: Unexpected server response: 404
    ...
    
    1263:  at Socket.socketOnData (node:_http_client:541:22)
    1264:  at Socket.emit (node:events:517:28)
    1265:  at addChunk (node:internal/streams/readable:368:12)
    1266:  at readableAddChunk (node:internal/streams/readable:341:9)
    1267:  at Readable.push (node:internal/streams/readable:278:10)
    1268:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1269:  37) Script commands
    1270:  can evaluate script with result ownership:
    1271:  Uncaught Error: Unexpected server response: 404
    ...
    
    1276:  at Socket.socketOnData (node:_http_client:541:22)
    1277:  at Socket.emit (node:events:517:28)
    1278:  at addChunk (node:internal/streams/readable:368:12)
    1279:  at readableAddChunk (node:internal/streams/readable:341:9)
    1280:  at Readable.push (node:internal/streams/readable:278:10)
    1281:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1282:  38) Script commands
    1283:  can evaluate in a sandbox:
    1284:  Uncaught Error: Unexpected server response: 404
    ...
    
    1289:  at Socket.socketOnData (node:_http_client:541:22)
    1290:  at Socket.emit (node:events:517:28)
    1291:  at addChunk (node:internal/streams/readable:368:12)
    1292:  at readableAddChunk (node:internal/streams/readable:341:9)
    1293:  at Readable.push (node:internal/streams/readable:278:10)
    1294:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1295:  39) Script commands
    1296:  can evaluate in a realm:
    1297:  Uncaught Error: Unexpected server response: 404
    ...
    
    1302:  at Socket.socketOnData (node:_http_client:541:22)
    1303:  at Socket.emit (node:events:517:28)
    1304:  at addChunk (node:internal/streams/readable:368:12)
    1305:  at readableAddChunk (node:internal/streams/readable:341:9)
    1306:  at Readable.push (node:internal/streams/readable:278:10)
    1307:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1308:  40) Script commands
    1309:  can disown handles:
    1310:  Uncaught Error: Unexpected server response: 404
    ...
    
    1315:  at Socket.socketOnData (node:_http_client:541:22)
    1316:  at Socket.emit (node:events:517:28)
    1317:  at addChunk (node:internal/streams/readable:368:12)
    1318:  at readableAddChunk (node:internal/streams/readable:341:9)
    1319:  at Readable.push (node:internal/streams/readable:278:10)
    1320:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1321:  41) Script commands
    1322:  can disown handles in realm:
    1323:  Uncaught Error: Unexpected server response: 404
    ...
    
    1328:  at Socket.socketOnData (node:_http_client:541:22)
    1329:  at Socket.emit (node:events:517:28)
    1330:  at addChunk (node:internal/streams/readable:368:12)
    1331:  at readableAddChunk (node:internal/streams/readable:341:9)
    1332:  at Readable.push (node:internal/streams/readable:278:10)
    1333:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1334:  42) Script commands
    1335:  "after each" hook for "can disown handles in realm":
    1336:  Uncaught Error: Unexpected server response: 404
    ...
    
    1341:  at Socket.socketOnData (node:_http_client:541:22)
    1342:  at Socket.emit (node:events:517:28)
    1343:  at addChunk (node:internal/streams/readable:368:12)
    1344:  at readableAddChunk (node:internal/streams/readable:341:9)
    1345:  at Readable.push (node:internal/streams/readable:278:10)
    1346:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1347:  43) Script commands
    1348:  "after each" hook for "can disown handles in realm":
    1349:  Error: done() called multiple times in hook <Script commands "after each" hook for "can disown handles in realm"> of file D:\a\seleniumhq.github.io\seleniumhq.github.io\examples\javascript\test\bidirectional\script_commands.spec.js
    1350:  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    1351:  44) Script events
    1352:  can listen to channel message:
    1353:  Uncaught Error: Unexpected server response: 404
    ...
    
    1358:  at Socket.socketOnData (node:_http_client:541:22)
    1359:  at Socket.emit (node:events:517:28)
    1360:  at addChunk (node:internal/streams/readable:368:12)
    1361:  at readableAddChunk (node:internal/streams/readable:341:9)
    1362:  at Readable.push (node:internal/streams/readable:278:10)
    1363:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1364:  45) Script events
    1365:  can listen to realm created message:
    1366:  Uncaught Error: Unexpected server response: 404
    ...
    
    1371:  at Socket.socketOnData (node:_http_client:541:22)
    1372:  at Socket.emit (node:events:517:28)
    1373:  at addChunk (node:internal/streams/readable:368:12)
    1374:  at readableAddChunk (node:internal/streams/readable:341:9)
    1375:  at Readable.push (node:internal/streams/readable:278:10)
    1376:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1377:  46) BiDi Logging
    1378:  can remove console log handler:
    1379:  Uncaught Error: Unexpected server response: 404
    ...
    
    1384:  at Socket.socketOnData (node:_http_client:541:22)
    1385:  at Socket.emit (node:events:517:28)
    1386:  at addChunk (node:internal/streams/readable:368:12)
    1387:  at readableAddChunk (node:internal/streams/readable:341:9)
    1388:  at Readable.push (node:internal/streams/readable:278:10)
    1389:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1390:  47) BiDi Script
    1391:  can listen to dom mutations:
    1392:  Uncaught Error: Unexpected server response: 404
    ...
    
    1397:  at Socket.socketOnData (node:_http_client:541:22)
    1398:  at Socket.emit (node:events:517:28)
    1399:  at addChunk (node:internal/streams/readable:368:12)
    1400:  at readableAddChunk (node:internal/streams/readable:341:9)
    1401:  at Readable.push (node:internal/streams/readable:278:10)
    1402:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1403:  48) BiDi Script
    1404:  can remove to dom mutation handler:
    1405:  Uncaught Error: Unexpected server response: 404
    ...
    
    1410:  at Socket.socketOnData (node:_http_client:541:22)
    1411:  at Socket.emit (node:events:517:28)
    1412:  at addChunk (node:internal/streams/readable:368:12)
    1413:  at readableAddChunk (node:internal/streams/readable:341:9)
    1414:  at Readable.push (node:internal/streams/readable:278:10)
    1415:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1416:  49) BiDi Script
    1417:  can pin script:
    1418:  Uncaught Error: Unexpected server response: 404
    ...
    
    1423:  at Socket.socketOnData (node:_http_client:541:22)
    1424:  at Socket.emit (node:events:517:28)
    1425:  at addChunk (node:internal/streams/readable:368:12)
    1426:  at readableAddChunk (node:internal/streams/readable:341:9)
    1427:  at Readable.push (node:internal/streams/readable:278:10)
    1428:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1429:  50) BiDi Script
    1430:  can unpin script:
    1431:  Uncaught Error: Unexpected server response: 404
    ...
    
    1436:  at Socket.socketOnData (node:_http_client:541:22)
    1437:  at Socket.emit (node:events:517:28)
    1438:  at addChunk (node:internal/streams/readable:368:12)
    1439:  at readableAddChunk (node:internal/streams/readable:341:9)
    1440:  at Readable.push (node:internal/streams/readable:278:10)
    1441:  at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
    1442:  51) Service Test
    1443:  Set Driver Location:
    1444:  Error: Timed out waiting for the WebDriver server at http://127.0.0.1:56029/C:\Users\runneradmin\.cache\selenium\chromedriver\win64\127.0.6533.99\chromedriver.exe
    1445:  at onError (node_modules\selenium-webdriver\http\util.js:89:16)
    1446:  at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    1447:  ##[warning]Attempt 2 failed. Reason: Child_process exited with error code 1
    ...
    
    1482:  ✔ Scroll to the element (2610ms)
    1483:  Actions API - Wheel Tests
    1484:  ✔ Scroll to element (989ms)
    1485:  ✔ Scroll by given amount (575ms)
    1486:  ✔ Scroll from an element by a given amount (601ms)
    1487:  ✔ Scroll from an element with an offset (609ms)
    1488:  ✔ Scroll from an offset of origin (element) by given amount (1064ms)
    1489:  Integration Tests
    1490:  1) test navigate and listen to errors
    ...
    
    1516:  - can locate node with none ownership value
    1517:  - can locate node with root ownership value
    1518:  - can locate node with given start nodes
    1519:  - can locate nodes in a given sandbox
    1520:  - can find element
    1521:  - can find elements
    1522:  Log Inspector
    1523:  ✔ test listen to console log (5403ms)
    1524:  11) test listen to javascript error log
    ...
    
    1565:  ✔ can remove preload script (5351ms)
    1566:  Script events
    1567:  39) can listen to channel message
    1568:  ✔ can listen to realm created message (4785ms)
    1569:  - can listen to realm destroyed message
    1570:  BiDi Logging
    1571:  40) can listen to console log
    1572:  41) can remove console log handler
    1573:  ✔ can listen to javascript error (6566ms)
    1574:  ✔ can remove to javascript error handler (6619ms)
    ...
    
    1730:  ✔ Try selecting disabled option
    1731:  Virtual authenticator
    1732:  ✔ Register a virtual authenticator
    1733:  ✔ Remove authenticator
    1734:  ✔ Createa and add residential key
    1735:  ✔ Add resident credential not supported when authenticator uses U2F protocol
    1736:  ✔ Create and add non residential key
    1737:  ✔ Get credential
    1738:  ##[error]Final attempt failed. Timeout of 1200000ms hit
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    Copy link
    Contributor

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible bug
    Initialize the service variable properly to avoid runtime errors

    Ensure that the service variable is properly initialized before use in the 'Default
    service' test. Currently, the ServiceBuilder is instantiated but not configured,
    which might lead to unexpected behavior.

    examples/javascript/test/drivers/service.spec.js [8]

    -let service = new Chrome.ServiceBuilder()
    +let service = new Chrome.ServiceBuilder().build();
     
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: Properly initializing the service variable by calling .build() ensures that the ServiceBuilder is correctly configured, which is crucial to avoid potential runtime errors.

    9
    Possible issue
    Rename local variable to avoid shadowing the global variable

    To avoid potential issues with variable shadowing, rename the local options variable
    in the 'Set Driver Location' test to something more specific. This helps prevent
    confusion with the options variable defined at the global scope.

    examples/javascript/test/drivers/service.spec.js [21-22]

    -let options = new Chrome.Options();
    -options.setBrowserVersion("stable")
    +let localOptions = new Chrome.Options();
    +localOptions.setBrowserVersion("stable")
     
    • Apply this suggestion
    Suggestion importance[1-10]: 8

    Why: Renaming the local options variable to localOptions avoids potential issues with variable shadowing and improves code clarity, which is important for maintainability and readability.

    8
    Best practice
    Use const for variables that are not reassigned to improve readability and consistency

    Consider using const for service and driver variables if they are not reassigned
    within their respective blocks. This change enhances code readability and maintains
    consistency.

    examples/javascript/test/drivers/service.spec.js [43-45]

    -let service = new Chrome.ServiceBuilder().setPort(1234)
    -let driver = new Builder()
    +const service = new Chrome.ServiceBuilder().setPort(1234)
    +const driver = new Builder()
     
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Using const for variables that are not reassigned enhances code readability and consistency, although it is a minor improvement.

    7
    Maintainability
    Refactor common setup code into a beforeEach block for better test isolation and readability

    To improve test isolation and readability, consider separating the instantiation of
    options, service, and driver into a beforeEach block if they are common across
    multiple tests.

    examples/javascript/test/drivers/service.spec.js [21-32]

    -let options = new Chrome.Options();
    -let service = new Chrome.ServiceBuilder().setPath(driverPath)
    -let driver = new Builder()
    +beforeEach(() => {
    +  options = new Chrome.Options();
    +  service = new Chrome.ServiceBuilder().setPath(driverPath);
    +  driver = new Builder();
    +});
     
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: Refactoring common setup code into a beforeEach block can improve test isolation and readability, but it may not be necessary if the setup code is not repeated across multiple tests.

    6

    Copy link

    netlify bot commented Aug 9, 2024

    Deploy Preview for selenium-dev ready!

    Name Link
    🔨 Latest commit cc00794
    🔍 Latest deploy log https://app.netlify.com/sites/selenium-dev/deploys/66b9bde3a5072f000862f309
    😎 Deploy Preview https://deploy-preview-1848--selenium-dev.netlify.app
    📱 Preview on mobile
    Toggle QR Code...

    QR Code

    Use your smartphone camera to open QR code link.

    To edit notification comments on pull requests, go to your Netlify site configuration.

    Copy link
    Member

    @harsha509 harsha509 left a comment

    Choose a reason for hiding this comment

    The reason will be displayed to describe this comment to others. Learn more.

    Thank you @pujagani !

    @harsha509 harsha509 merged commit 5ed0e4f into trunk Aug 12, 2024
    8 of 12 checks passed
    @harsha509 harsha509 deleted the add-js-service-example branch August 12, 2024 10:27
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants