what is diffrence between findElement and findElements ? #2837
Unanswered
irondev84
asked this question in
Help Needed
Replies: 2 comments
-
|
I see the main diffrence is that in |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
The try/catch is intended to work in v2, not the current version. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Describe
Please tell me what is the diffrence between
findElementandfindElements?Look at sample below:
Sample test
OUTPUT:
{ sessionId: '84f22cc63295758237971629b3dc624a', status: 0, value: [] }OUTPUT:
NoSuchElementError: An error occurred while running .findElement() command on <#authorization-code>: {"sessionId":"84f22cc63295758237971629b3dc624a","status":0,"value":[]} at Object.module.exports.command (\tests\commands\AuthorizeTransaction.js:27:8) at runMicrotasks (<anonymous>) at processTicksAndRejections (internal/process/task_queues.js:93:5)I would like to know why If an element doesn't exist the API
findElementsreturn object with emptyvalueproperty, but in case offindElementit throwNoSuchElementError?Which behaviour is intentionally ?
And the next question is, why if I use
try...catchconstruction, like you recommend, in case ofNoSuchElementErrorit doesn't work correctly ? Example below:it always throw
NoSuchElementError?I dont know what do you mean related to this issue and how to use try catch block ?
Environment
nightwatch --versionBeta Was this translation helpful? Give feedback.
All reactions