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
-
Describe
Please tell me what is the diffrence between
findElement
andfindElements
?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
findElements
return object with emptyvalue
property, but in case offindElement
it throwNoSuchElementError
?Which behaviour is intentionally ?
And the next question is, why if I use
try...catch
construction, like you recommend, in case ofNoSuchElementError
it 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 --version
Beta Was this translation helpful? Give feedback.
All reactions