Comments (1)
This is actually a known issue where the test run ends abruptly on unhandledRejection
or uncaughtError
and I had started working on it but then had to re-prioritize stuff. I'll try to take this up on priority again.
But for your particular examples, it will be handled correctly by Nightwatch if you move the await
from inside to outside the parenthesis:
const billingCard = locateWith(By.css(`body`));
const headerElement = await browser.element.find(billingCard).findElement(
By.css('[this="doesntExist"]')
);
Explanation for above: When you do browser.element.find()
, it returns a Nightwatch wrapper around the actual result, that contains the various API methods provided by Nightwatch (like chained .find()
commands, .getText()
, etc). But when you await
this statement, it would resolve to the actual result (a WebElement instance here).
Now, if you do .findElement()
on the WebElement
instance directly (which you are doing in the example provided), it would directly go to Selenium and any errors won't be handled by Nightwatch (though we should add something to handle it in future), so you get the unhandledRejection
error.
But if you call the findElement()
on the Nightwatch wrapper directly, then the .findElement()
command would go through the Nightwatch implementation, where everything is handled. This .findElement()
will also in turn return the Nightwatch wrapper around the actual result, so to get the actual final result you can use await
over the entire statement.
from nightwatch.
Related Issues (20)
- Abort test on `waitUntil` failure when using it standalone with async/await. HOT 6
- Nightwatch commands in `waitUntil` callback return `NightwatchAPI` instead of a `Promise`. HOT 9
- 4000+ tests eats up disk space *nom* HOT 2
- Add aliases for `getCssProperty` command in new Element API HOT 1
- Feat: Add aliases for `getAttribute` in the new Element API. HOT 1
- Feat: Add `prop` and `property` as an alias of `getProperty` Command in the new Element API HOT 1
- Add `tagName` as an alias of `getTagName` in the new Element API
- Add `accessibleName` as an alias for `getAccessibleName` in the new Element API.
- Add `text` as an alias for `getText` command in the new Element API. HOT 1
- Nightwatch HTML Report overall time displaying different overall times within the same report HOT 1
- Stale element reference errors should report the element and/or line of code it considers stale HOT 2
- isPresent command misleading, works same as waitUntilElementPresent HOT 2
- Show command usage location in new Element API errors. HOT 4
- Feat: Add `.print()` command in nightwatch. HOT 5
- Need to bump ejs version to 3.1.10 due to vulnerability HOT 2
- When opening this page https://nightwatchjs.org/guide/overview/what-is-nightwatch.html docs are overlapping.
- While opening this page https://nightwatchjs.org/guide/overview/what-is-nightwatch.html docs writing are overlapping. HOT 3
- Functional tests fail with socket hang up mid test
- Can't assert off find as documentation would suggest HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nightwatch.