healenium / healenium

Self-healing library for Selenium Web-based tests
https://healenium.io/
Apache License 2.0
89 stars 20 forks source link

[BUG]: WDIO session not found issue after every run #33

Open steenpjames5 opened 1 year ago

steenpjames5 commented 1 year ago

Describe the bug

I'm using WDIO along with Healenium - Selenoid for the automation. After every execution, WDIO will call a command deleteSession() for close the browser. But when I use Healenium- selenoid combination I got the following error-

"Request failed with status 500 due to Cannot invoke "com.epam.healenium.handlers.SelfHealingHandler.quit()" because the return value of "com.epam.healenium.healenium_proxy.model.SessionContext.getSelfHealingHandlerBase()" is nul"

If I use Selenoid only, the script will run successfully. Please find the below image for more details

How to reproduce the issue

Step1- Create script using WDIO
Step2- Connect Healenium - Selenoid in conf file
Step3- Execute script. Wait until the script finishes.

Logs appeared during using Healenium

Execution of 1 workers started at 2023-11-08T10:58:55.379Z

2023-11-08T10:58:55.396Z INFO @wdio/cli:launcher: Run onPrepare hook
2023-11-08T10:58:55.399Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2023-11-08T10:58:55.400Z INFO @wdio/local-runner: Start worker 0-0 with arg: wdio.conf.js
[0-0] 2023-11-08T10:58:56.427Z INFO @wdio/local-runner: Run worker command: run
[0-0] RUNNING in chrome - file:///test/specs/test.e2e.js
[0-0] 2023-11-08T10:58:56.522Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2023-11-08T10:58:56.523Z INFO @wdio/utils: Connecting to existing driver at http://localhost:8085/
[0-0] 2023-11-08T10:58:56.567Z INFO webdriver: [POST] http://localhost:8085/session
[0-0] 2023-11-08T10:58:56.567Z INFO webdriver: DATA {
[0-0]   capabilities: { alwaysMatch: { browserName: 'chrome' }, firstMatch: [ {} ] },
[0-0]   desiredCapabilities: { browserName: 'chrome' }
[0-0] }
[0-0] 2023-11-08T10:59:05.876Z INFO webdriver: COMMAND setWindowRect(null, null, 1920, 1080)
[0-0] 2023-11-08T10:59:05.877Z INFO webdriver: [POST] http://localhost:8085/session/71f6ce687ba57f93bbd542452b6387ae/window/rect
[0-0] 2023-11-08T10:59:05.878Z INFO webdriver: DATA { x: null, y: null, width: 1920, height: 1080 }
[0-0] 2023-11-08T10:59:06.004Z INFO webdriver: RESULT { height: 1079, width: 1919, x: 10, y: 10 }
[0-0] 2023-11-08T10:59:06.022Z INFO webdriver: COMMAND navigateTo("https://www.wikipedia.org/")
[0-0] 2023-11-08T10:59:06.023Z INFO webdriver: [POST] http://localhost:8085/session/71f6ce687ba57f93bbd542452b6387ae/url
[0-0] 2023-11-08T10:59:06.024Z INFO webdriver: DATA { url: 'https://www.wikipedia.org/' }
[0-0] 2023-11-08T10:59:08.171Z INFO webdriver: RESULT null
[0-0] 2023-11-08T10:59:13.178Z INFO webdriver: COMMAND deleteSession()
[0-0] 2023-11-08T10:59:13.180Z INFO webdriver: [DELETE] http://localhost:8085/session/71f6ce687ba57f93bbd542452b6387ae
[0-0] 2023-11-08T10:59:13.265Z WARN webdriver: Request failed with status 200 due to session timed out or not found
[0-0] 2023-11-08T10:59:13.266Z INFO webdriver: Retrying 1/3
[0-0] 2023-11-08T10:59:13.266Z INFO webdriver: [DELETE] http://localhost:8085/session/71f6ce687ba57f93bbd542452b6387ae
[0-0] 2023-11-08T10:59:20.490Z WARN webdriver: Request failed with status 500 due to Cannot invoke "com.epam.healenium.handlers.SelfHealingHandler.quit()" because the return value of "com.epam.healenium.healenium_proxy.model.SessionContext.getSelfHealingHandlerBase()" is null
[0-0] 2023-11-08T10:59:20.491Z INFO webdriver: Retrying 2/3
[0-0] 2023-11-08T10:59:20.491Z INFO webdriver: [DELETE] http://localhost:8085/session/71f6ce687ba57f93bbd542452b6387ae
[0-0] 2023-11-08T10:59:27.796Z WARN webdriver: Request failed with status 500 due to Cannot invoke "com.epam.healenium.handlers.SelfHealingHandler.quit()" because the return value of "com.epam.healenium.healenium_proxy.model.SessionContext.getSelfHealingHandlerBase()" is null
[0-0] 2023-11-08T10:59:27.796Z INFO webdriver: Retrying 3/3
[0-0] 2023-11-08T10:59:27.797Z INFO webdriver: [DELETE] http://localhost:8085/session/71f6ce687ba57f93bbd542452b6387ae
[0-0] 2023-11-08T10:59:34.944Z ERROR webdriver: Request failed with status 500 due to unknown error: Cannot invoke "com.epam.healenium.handlers.SelfHealingHandler.quit()" because the return value of "com.epam.healenium.healenium_proxy.model.SessionContext.getSelfHealingHandlerBase()" is null
[0-0] 2023-11-08T10:59:34.945Z ERROR @wdio/local-runner: Failed launching test session: unknown error: Cannot invoke "com.epam.healenium.handlers.SelfHealingHandler.quit()" because the return value of "com.epam.healenium.healenium_proxy.model.SessionContext.getSelfHealingHandlerBase()" is null
[0-0]     at getErrorFromResponseBody (file:///home/arunlal/node_modules/webdriver/build/utils.js:194:12)
[0-0]     at NodeJSRequest._request (file:///home/arunlal/node_modules/webdriver/build/request/index.js:164:23)
[0-0]     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
[0-0]     at async Browser.wrapCommandFn (file:///home/arunlal/node_modules/@wdio/utils/build/shim.js:81:29)
[0-0]     at async Runner.endSession (file:///home/arunlal/node_modules/@wdio/runner/build/index.js:396:9)
[0-0]     at async Runner.run (file:///home/arunlal/node_modules/@wdio/runner/build/index.js:160:13)
[0-0] FAILED in chrome - file:///test/specs/test.e2e.js
2023-11-08T10:59:34.983Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2023-11-08T10:59:34.984Z INFO @wdio/cli:launcher: Run onComplete hook

Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:39 

2023-11-08T10:59:34.987Z INFO @wdio/local-runner: Shutting down spawned worker
2023-11-08T10:59:35.239Z INFO @wdio/local-runner: Waiting for 0 to shut down gracefully
2023-11-08T10:59:35.239Z INFO @wdio/local-runner: shutting down

Expected behavior

No response

Actual behavior

No response

Healenium Web version

None

Healenium Backend version

3.4.1

Selenium version

4

Platform

Web driverIO (WDIO)

Additional context

No response

steenpjames5 commented 12 months ago

This issue is only with the hlm-proxy versions 1.3.0 or higher. The lower versions don't have this issue