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

[🐛 Bug]: Element not found doesnt show proper stack trace #8108

Closed
3 tasks done
praveendvd opened this issue Mar 13, 2022 · 20 comments
Closed
3 tasks done

[🐛 Bug]: Element not found doesnt show proper stack trace #8108

praveendvd opened this issue Mar 13, 2022 · 20 comments

Comments

@praveendvd
Copy link
Contributor

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

7.17.4

Node.js Version

v16.5.0

Mode

WDIO Testrunner

Which capabilities are you using?

No response

What happened?

[chrome 99.0.4844.51 windows #0-0]
[chrome 99.0.4844.51 windows #0-0] 1 failing (11.5s)
[chrome 99.0.4844.51 windows #0-0]
[chrome 99.0.4844.51 windows #0-0] 1) My Login application should login with valid credentials
[chrome 99.0.4844.51 windows #0-0] Error: Can't call setValue on element with selector "#ddd" because element wasn't found
[chrome 99.0.4844.51 windows #0-0] Error: Can't call setValue on element with selector "#ddd" because element wasn't found

in this typescript project it Doesnt throw any stack trace to show where the error was thrown

What is your expected behavior?

Should show line in spec file and pageobject where the error was orginated in

How to reproduce the bug.

package.zip

Relevant log output

[chrome 99.0.4844.51 windows #0-0]
[chrome 99.0.4844.51 windows #0-0] 1 failing (11.5s)
[chrome 99.0.4844.51 windows #0-0]
[chrome 99.0.4844.51 windows #0-0] 1) My Login application should login with valid credentials
[chrome 99.0.4844.51 windows #0-0] Error: Can't call setValue on element with selector "#ddd" because element wasn't found
[chrome 99.0.4844.51 windows #0-0] Error: Can't call setValue on element with selector "#ddd" because element wasn't found

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues
@praveendvd praveendvd added Bug 🐛 Needs Triaging ⏳ No one has looked into the issue yet labels Mar 13, 2022
@christian-bromann
Copy link
Member

@praveendvd I can't reproduce this, even without any reporters I get:

 npx wdio run ./test/wdio.conf.ts

Execution of 1 workers started at 2022-03-14T08:41:14.382Z

[0-0] RUNNING in chrome - /test/specs/example.e2e.ts
[0-0] Error in "My Login application.should login with valid credentials"
Error: Can't call setValue on element with selector "ddd" because element wasn't found
    at implicitWait (/private/tmp/8108/node_modules/webdriverio/build/utils/implicitWait.js:34:19)
    at async Element.elementErrorHandlerCallbackFn (/private/tmp/8108/node_modules/webdriverio/build/middlewares.js:20:29)
    at async Element.wrapCommandFn (/private/tmp/8108/node_modules/@wdio/utils/build/shim.js:137:29)
[0-0] FAILED in chrome - /test/specs/example.e2e.ts

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

How do I need to modify the starter package to reproduce this?

@christian-bromann christian-bromann added Reproducible Example Missing and removed Needs Triaging ⏳ No one has looked into the issue yet labels Mar 14, 2022
@praveendvd
Copy link
Contributor Author

I am using windows 10 and it happens as it is , I will cross check today @christian-bromann u know where is this error getting handled so that I can look into that also 🎉

@christian-bromann
Copy link
Member

Check our framework wrapper functions. WebdriverIO doesn't modify the stack traces.

@praveendvd
Copy link
Contributor Author

@christian-bromann i ran in windows and mac , i am gettign same behavior .

@praveendvd
Copy link
Contributor Author

image

@WillBrock
Copy link
Member

On Ubuntu it is showing the stacktrace for me. This is with a fresh install of latest. I noticed on Christian's example it only shows the stacktrace for wdio files but not the failure line on the example.e2e.ts file which is odd.

 "spec" Reporter:
------------------------------------------------------------------
[chrome 99.0.4844.74 linux #0-0] Running: chrome (v99.0.4844.74) on linux
[chrome 99.0.4844.74 linux #0-0] Session ID: ce71f3f338878872918f3dcfada89587
[chrome 99.0.4844.74 linux #0-0]
[chrome 99.0.4844.74 linux #0-0] » /test/specs/example.e2e.js
[chrome 99.0.4844.74 linux #0-0] My Login application
[chrome 99.0.4844.74 linux #0-0]     should login with valid credentials
[chrome 99.0.4844.74 linux #0-0]
[chrome 99.0.4844.74 linux #0-0] 1 failing (10.9s)
[chrome 99.0.4844.74 linux #0-0]
[chrome 99.0.4844.74 linux #0-0] 1) My Login application should login with valid credentials
[chrome 99.0.4844.74 linux #0-0] Can't call setValue on element with selector ".fffff" because element wasn't found
[chrome 99.0.4844.74 linux #0-0] Error: Can't call setValue on element with selector ".fffff" because element wasn't found
[chrome 99.0.4844.74 linux #0-0]     at implicitWait (/home/will/dev/wdio-stack/node_modules/webdriverio/build/utils/implicitWait.js:34:19)
[chrome 99.0.4844.74 linux #0-0]     at async Element.elementErrorHandlerCallbackFn (/home/will/dev/wdio-stack/node_modules/webdriverio/build/middlewares.js:20:29)
[chrome 99.0.4844.74 linux #0-0]     at async Element.wrapCommandFn (/home/will/dev/wdio-stack/node_modules/@wdio/utils/build/shim.js:137:29)
[chrome 99.0.4844.74 linux #0-0]     at async Context.<anonymous> (/home/will/dev/wdio-stack/test/specs/example.e2e.js:8:9)


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

@praveendvd
Copy link
Contributor Author

@WillBrock fore no stacktrace at all for mac n windows

@WillBrock
Copy link
Member

Interestingly in TypeScript it's not showing the stack line for the example.e2e.ts file

 "spec" Reporter:
------------------------------------------------------------------
[chrome 99.0.4844.74 linux #0-0] Running: chrome (v99.0.4844.74) on linux
[chrome 99.0.4844.74 linux #0-0] Session ID: c13a202bfb63b12b4a8edd1e6f17926f
[chrome 99.0.4844.74 linux #0-0]
[chrome 99.0.4844.74 linux #0-0] » /test/specs/example.e2e.ts
[chrome 99.0.4844.74 linux #0-0] My Login application
[chrome 99.0.4844.74 linux #0-0]     should login with valid credentials
[chrome 99.0.4844.74 linux #0-0]
[chrome 99.0.4844.74 linux #0-0] 1 failing (11s)
[chrome 99.0.4844.74 linux #0-0]
[chrome 99.0.4844.74 linux #0-0] 1) My Login application should login with valid credentials
[chrome 99.0.4844.74 linux #0-0] Can't call setValue on element with selector ".adfsadfs" because element wasn't found
[chrome 99.0.4844.74 linux #0-0] Error: Can't call setValue on element with selector ".adfsadfs" because element wasn't found
[chrome 99.0.4844.74 linux #0-0]     at implicitWait (/home/will/dev/wdio-st/node_modules/webdriverio/build/utils/implicitWait.js:34:19)
[chrome 99.0.4844.74 linux #0-0]     at async Element.elementErrorHandlerCallbackFn (/home/will/dev/wdio-st/node_modules/webdriverio/build/middlewares.js:20:29)
[chrome 99.0.4844.74 linux #0-0]     at async Element.wrapCommandFn (/home/will/dev/wdio-st/node_modules/@wdio/utils/build/shim.js:137:29)

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

@praveendvd
Copy link
Contributor Author

@christian-bromann n @WillBrock ya I am using typescript , n wdio built in ts-node for execution . ( Just run , npm run wdio)

@WillBrock
Copy link
Member

@praveendvd I discovered #8129. I don't think that would be why no stacktraces show for you but maybe it is.

@praveendvd
Copy link
Contributor Author

Will give it a try

@praveendvd
Copy link
Contributor Author

image

@WillBrock i get this error when target is es2019

@praveendvd
Copy link
Contributor Author

@WillBrock but it does fixes the issue (the project runs fine )

@WillBrock
Copy link
Member

This is beyond my TypeScript knowledge but WebdriverIO is defined in wdio-types/index.d.ts and webdriverio/async.d.ts. It looks like when target : "ES5" it uses what is defined in types/index.d.ts but target : "es2018"is using WebdriverIO in async.d.ts.

@christian-bromann
Copy link
Member

i get this error when target is es2019

See #8166 .. we should move away from namespaces towards type imports.

Is there any chance we can reproduce this for others? Or is this a Windows specific issue?

@praveendvd
Copy link
Contributor Author

@christian-bromann you mean the type issue or the stack trace issue? Stack trace issue is observed in all OS for me . But the type one I tried only in windows

@christian-bromann
Copy link
Member

Stack trace issue is observed in all OS for me

Is there a way to make it reproducible? Maybe demo repository with GitHub actions?

@praveendvd
Copy link
Contributor Author

@christian-bromann Will try that christian

@christian-bromann
Copy link
Member

@praveendvd how should we proceed with this? Did you have some time to work on a reproducible example?

@praveendvd
Copy link
Contributor Author

@christian-bromann its working now 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants