nightwatch.js

Click is skipping a child element on a dropdown menu

你离开我真会死。 提交于 2019-12-25 07:46:42
问题 Only the first child is ok, second is never clicked, the 3rd option is clicked but changed into the first option too quick that it doesn´t have time to get the URL. Tried to increase pauses and waiting times but it didn´t work. module.exports = { 'Language Selection': function(browser) { const homePage = browser.page.language(); var j = 0; for (var i in homePage.elements) { homePage .navigate() .waitForElementVisible('#azercell_language_selector', 2000) .click('#azercell_language_selector');

Nightwatch.js cannot set a string variable to an input field?

痞子三分冷 提交于 2019-12-25 03:08:56
问题 I am testing some JavaScript code with Nightwatch.js. I want to read a value from an input tag, increase or decrease it by 1 and then write it back to the input tag. Therefore I wrote this code: .getValue('#inputConfigReading', function(result){ val = parseInt(result.value); if (val % 2 == 0) val++; else val--; val = val+''; }) .clearValue('#inputConfigReading') .setValue('#inputConfigReading', val) I checked it out. The variable val has the correct value after the command val = val+''; . But

nightwatch js while loop

纵然是瞬间 提交于 2019-12-25 02:55:28
问题 I'm new to node and nightwatch. Been working with Selenium for a number of years but my company has moved over to all things node. Anyway, in nightwatch I am trying to click a link while its visible and loop and keep clicking it until it is not. Here is what my code looks like. Any suggestions would be much appreciated! "Cart Cleanup": function (browser) { browser .url(environment + '/ShoppingBag') .waitForElementVisible('div.cart-top-message', 190000) .pause(3000) .element('class name',

NIghtwatch.js File Upload with Dropzone.js

痴心易碎 提交于 2019-12-24 11:28:50
问题 I am trying to upload a pdf file on our file upload using nightwatch.js but the thing is there are no input type="file" on our upload. The html looks like this: <form id="dropzone" action="/v2/asset/56013895934fd606006fb314" class="dropzone dz-clickable"> <div class="dz-clickable" id="dropzonePreview"> <i class="fa fa-cloud-upload main-icon initial-icon"></i> </div> <div class="dz-default dz-message"> <span>Drop a file here or click icon above to upload an image</span> </div> </form> I tried

nightwatch.js - scroll until element is visible

那年仲夏 提交于 2019-12-24 07:25:57
问题 I want to scroll page until desired element appear visible. I have tried: browser.execute(function () { window.scrollBy(0, 10000000); }, []); and browser.getLocationInView("<selector>", function(result) { this.assert.equal(typeof result, "object"); this.assert.equal(result.status, 0); this.assert.equal(result.value.x, 200); this.assert.equal(result.value.y, 200); }); First do not scroll page and second fails because element is not visible. How to fix this? I want to scroll till element appear

Nightwatch.js always returns exit code 1

随声附和 提交于 2019-12-24 01:44:08
问题 I try to integrate my Nightwatch.js tests in a Jenkins Job. I want the Jenkins build to fail if the tests will fail and I want the build to pass if all tests will pass. But I recognized that Nightwatch always returns the exit code 1 , doesn't matter if the tests will pass or fail. But I expect that the exit code 0 will be return if all tests will pass. Does anyone have a solution for that issue? I use nightwatch@0.9.19 in combination with nightwatch-cucumber@9.0.0 . This is my Nightwatch call

Multiple page objects in one test case

北城以北 提交于 2019-12-24 00:43:34
问题 So far the example is only using one page object in a test case. Can we have multiple page objects in a test case? Imagine that I have a test case which required to login, and then followed by creating an user. So I have two page objects, one for login page and another for user page. We will use the page objects like this? module.exports = { 'login': function (browser) { var login = browser.page.login(); login.navigate() .click('@submit'); }, 'create user': function (browser) { var users =

Not able to close the browser using NightwatchJS

百般思念 提交于 2019-12-23 19:25:41
问题 I am trying to open my url using Nightwatch and I wan't able to close the browser afterwards. I tried using timeouts, as well as browser.end() , or browser.closeWindow() . None of them seem to be working for my url. module.exports = { 'Demo test mywrkouts' : function (browser) { browser.url('https://www.mywrkouts.com/workouts/search') browser.timeouts('script', 10000, function(result) { browser.end(); console.log("Test result"+result); }); //browser.closeWindow(); } }; It opens the page, but

How to paste using the keys command in nightwatch?

浪子不回头ぞ 提交于 2019-12-23 09:15:38
问题 How can I paste in nightwatch? I tried this command: browser.keys([browser.Keys.COMMAND, browser.Keys.v]) But the command is not working. Ideally I would lake to be able to save the copied text into a variable. 回答1: I had to add the third NULL parameter to all commands, not only the last one, then it worked. Sadly, I can't find any documentation about how this exactly works. My usecase was selecting everything on a page with an image on it (ctrl+a), copying it (ctrl+v) and then navigating to

Why does Nightwatch / Selenium give me a 'Connection reset' error?

試著忘記壹切 提交于 2019-12-23 02:57:09
问题 I'm using Ubuntu Linux, Selenium 2.53, Nightwatch.js 0.9. When running my test with the given nightwatch.json I get a 'connection reset' error from Selenium, even though Selenium says it starts successfully. What am I doing wrong? 来源: https://stackoverflow.com/questions/38657508/why-does-nightwatch-selenium-give-me-a-connection-reset-error