nightwatch.js

switch to a frame with Nightwatch.js

允我心安 提交于 2019-12-07 12:18:15
问题 the UI I am testing is using an iframe. I am trying to switch to that iframe with the ".frame(0)" call. module.exports = { "test" : function (browser) { browser .url("my_url") .waitForElementVisible(".frame-application-scroll-wrapper", 30000) .frame(0) .waitForElementPresent("#page-content", 30000) .end(); } }; However, #page-content is never seen which makes me think that the change frame command did not work (but returns no error neither). Any ideas? Thanks, Paul 回答1: as Neoaptt mentioned

NightWatch.js - get a list of child WebElements based on relative css locator

你离开我真会死。 提交于 2019-12-07 11:56:51
问题 Hello all NightWatch adopters, I am trying to parse a table with the following format to get a a list of rows and the cell in each rows <tbody> <tr> // 1 row <td>Item A</td> // name <td>John</td> // owner <td>Monday</td> // create date </tr> <tr> // 2 row <td>Item B</td> <td>Mary</td> <td>Tuesday</td> </tr> </tbody> The code now looks like this which calls the function below. browser.elements('css selector', 'tbody tr', getResultsList); Where my function for parsing now looks like this.

Validating download file in Nightwatch

大城市里の小女人 提交于 2019-12-07 09:57:26
I am Trying to write a test using nightwatch js to validate the file is downloaded after click on button/link in the web page. No need to check data inside file, i would only require to check if the file is downloaded or not. Also before I download I have to delete the existing files from download folder so that copy of same file doesn't occur. How this can be achieved in Nightwatch js? Please help me. 来源: https://stackoverflow.com/questions/47186671/validating-download-file-in-nightwatch

How to debug nightwatch tests in VS Code

老子叫甜甜 提交于 2019-12-07 03:30:31
问题 I'm trying to debug nightwatch e2e tests using VS Code. I write my tests using typescript. It can work only when I put a breakpoint in js file, after that it goes to ts file and I can debug it from there. If I put it in ts file of my test - it will never stop and it is written "“Breakpoint ignored because generated code not found”. My source files are compiled using ts compiler to folder /dist/dev/specs/e2e/nightwatch/src. Code from the launch.json "name": "Launch e2e Tests on chrome", "type"

How to bypass recaptcha human check in nightwatch test?

醉酒当歌 提交于 2019-12-07 01:58:30
问题 I'm writing a nightwatch test for a Backbone View that includes Google's "recaptcha" human check. Obviously, the test is a bot, and so it can't pass the test. So I'm trying to figure out a way to bypass the human check in the test. Can anyone suggest a way to do this that is elegant? At the moment, the only possibility I can see is setting a query parameter on the url that nightwatch uses to load the page, and then checking for that query parameter within the logic of the Backbone view, but

Nightwatch can't locate element via css id or class selectors

一个人想着一个人 提交于 2019-12-07 00:33:28
问题 We're using Nightwatch to automate some of our UI testing. Some of the current tests are rather brittle, mostly having to do with weird CSS selectors, and I'm trying to simplify them. But some of the simple CSS selectors that I would expect to work are, well, not. I'm trying to find this deeply nested <a> tag: <a class="btn btn-quote btn-crm" href="/crm/" id="btnEndSession" style="display: inline-block;">End Session</a> Here's a bit of code that's working: .waitForElementVisible('

How to make a globally accessible variable?

落爺英雄遲暮 提交于 2019-12-06 20:04:05
问题 How can I make a globally accessible variable in nightwatch.js? I'm using a variable to store a customized url (dependent on which store is loaded in our online product), but I need it to be accessible across several javascript functions. It appears the value of it resets after each function ends, despite it being declared outside of the function at the head of the file. 回答1: It's been some time since you asked your question and support for what you requested might not have been (natively)

nightwatch custom command callback

て烟熏妆下的殇ゞ 提交于 2019-12-06 11:00:36
问题 I'm trying to create a custom command in nightwatch that runs a query on a Postgres database and returns the result. The query runs just fine and outputs the result to the console but then the execution of the test stops. I don't understand how callbacks work. How can I fix this custom command? exports.command = function(sql, callback) { var self = this; var pg = require('pg'); var conString = self.globals.testinfo.connectionString; var db = new pg.Client(conString); db.connect(function(err)

Random failure of selenium test on test server

余生颓废 提交于 2019-12-06 08:47:54
I'm working on a project which uses nodejs and nighwatch for test automation. The problem here is that the tests are not reliable and give lots of false positives. I did everything to make them stable and still getting the errors. I went through some blogs like https://bocoup.com/blog/a-day-at-the-races and did some code refactoring. Did anyone have some suggestions to solve this issue. At this moment I have two options, either I rewrite the code in Java(removing nodejs and nightwatch from solution as I'm far more comfortable in Java then Javascript. Most of the time, struggle with the non

How can I run multiple tests in parallel with JS/nightwatchjs?

前提是你 提交于 2019-12-06 06:59:57
问题 Can I execute multiple test cases in parallel through Nightwatch ?Is it Possible? I am searching for ability of threading capability in java for parallel test case execution. Also what do you guys think about moving from Selenium to Nightwatch? 回答1: You can see the thread for parallelism: nightwatchjs also take a look into parallel run Nightwatch is using the same selenium webdriver protocol but with some extra additions. 回答2: Yes you can leverage the parallel mode of nightwatch js using