Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 14:09
    gravityvi closed #2653
  • 14:09
    gravityvi closed #2653
  • 11:12

    beatfactor on main

    fix vulnerability in dependency (compare)

  • 11:12

    beatfactor on main

    fix vulnerability in dependency (compare)

  • 09:54
    Dharin-shah commented #2508
  • 09:54
    Dharin-shah commented #2508
  • 09:53
    Dharin-shah opened #2656
  • 09:53
    Dharin-shah opened #2656
  • 08:46
    beatfactor locked #2654
  • 08:46
    beatfactor locked #2654
  • 08:46
    beatfactor closed #2654
  • 08:46
    beatfactor closed #2654
  • 08:46
    beatfactor commented #2654
  • 08:46
    beatfactor commented #2654
  • 07:57
    ravikumar2000 opened #2654
  • 07:57
    ravikumar2000 opened #2654
  • Apr 17 16:54
    gravityvi edited #2653
  • Apr 17 16:54
    gravityvi edited #2653
  • Apr 17 13:35
    beatfactor commented #2625
  • Apr 17 13:35
    beatfactor commented #2625
Herbert Knapp
@HMKnapp
i'm using docker selenium/hub with selenium/node-chrome
what i tried so far apart from excluding network errors with the 1.1.1.1 and using the source print to make sure it is not a network issue, i used waitForElementPresent() as well but with the same result: timeout
Herbert Knapp
@HMKnapp

interestingly a titleContains() works:

.assert.titleContains('The free app')

but any waitForElement{Present,Visible} afterwards fails, times out

Herbert Knapp
@HMKnapp
SOLVED! it's chrome, not nightwatchjs. will post solution in a minute
Herbert Knapp
@HMKnapp
SOLUTION: use selenium/node-chrome:3.14.0-gallium all other versions tried did not work for me
Diego Molina
@diemol
That is not really a proper solution, https://github.com/SeleniumHQ/docker-selenium/releases/tag/3.14.0-gallium uses Google Chrome: 69.0.3497.100, that is a version released 2 years ago
probably something has evolved in Chrome and Nightwatch needs to catch up
Herbert Knapp
@HMKnapp
@diemol true, not the best option. i have since scrapped it and gone with selenium docker grid and version 4.0.0-alpha-7-prerelease-20201009. still using nightwatchjs for testing. works fine so far, just not with opera for some reason
shreev1
@shreev1
Hi Friends, I am facing an issue. Nightwatch setup is perfectly working with chrome but when i run for IE, it gives me -- Connection Refused! Is Selenium server started? When I checked in the logs for more details, I got logs trace like - Selenium is up and running, session Cleaner initialized with insideBrowserTimeout, creating new session for capabilities and then --Failed to load the library from temp directory.
I beleive IE Driver is creating a IDE tmp file in temp folder and then getting error
Any help will be highly appreciated
I tried downloading a IE Driver and executing, thats having same issue with error message as -- Could not find entry point in extracted library
shreev1
@shreev1
anybody having steps to setup nightwatch with IE driver to execute the tests on Internet explorer
Andrei Rusu
@beatfactor

Hey everyone, we just released v1.5. You can now use libraries like the selenium-webdriver or webdriver.io directly inside your Nightwatch tests! I personally think that this is pretty much a game-changer .

https://twitter.com/nightwatchjs/status/1318651996136738817

zwbetz-gh
@zwbetz-gh
Very nice!
Amit Zur
@amitzur
Hello, could you help me with answering this question about custom commands?
https://groups.google.com/u/1/g/nightwatchjs/c/pKwbiuPExGg
Joost De Cock
@joostdecock

Hi everyone. Love nightwatch, and I was hoping to use it at work, but I've hit a snag.
I'm writing a customer reporter for nightwatch that puts results of tests into Kafka (using kafka-node).
This involves some async code, and I'm having this weird issue that the tests just hang at the end waiting for I don't know what.
The hang is indefinite, certainly longer than any timeouts I've configured.
I can get it to return by creating an uncaught error, which will make nightwatch return. I can even cause the error after putting the data in kafka so that it works but obviously that's super hackish.

The documentation on custom reporters is kinda limited. Essentially it's just the function signature. I run done() when done, but it's not having any effect somehow.
I was wondering if there's any documentation or write-up on how/when/where the customer reporter is called, to give me a head-start on debugging this.

Thanks in advance for any input and thoughts on the matter :)

1 reply
VikasGhorpade
@VikasGhorpade

Hi Team,
I need a help with NightwatchJS. We have selenium grid deployed on aws and configured with our NightwatchJS. We have chrome browser version 76 on grid server. We want to upgrade chrome version. When we upgraded it to any higher version from 76, then we are getting following error:
We already have w3c set to false in nightwatch.json file under chrome options
→ Running command: session ([Function])
Request GET http://<selenium server host>:4444 /wd/hub/session/2ad13ccc1a4708a8221398b8b9fbf32b
Response 404 GET http://<selenium server host>:4444/wd/hub/session/2ad13ccc1a4708a8221398b8b9fbf32b (342ms)
{
value: {
error: [],
message: 'unknown command: Cannot call non W3C standard command while in W3C mode'
}
}
Error while running .sessionAction() protocol action: Unknown command 404 Not Found

SampleTest
Session Id->undefined
→ Completed command: session ([Function]) (347ms)

→ Running command: windowMaximize ()
Request POST http://<selenium server host>:4444 /wd/hub/session/2ad13ccc1a4708a8221398b8b9fbf32b/window/current/maximize
{}
Response 404 POST http://<selenium server host>:4444/wd/hub/session/2ad13ccc1a4708a8221398b8b9fbf32b/window/current/maximize (365ms)
{
value: {
error: [],
message: 'unknown command: Cannot call non W3C standard command while in W3C mode'
}

Help is appreciated.
}
Error while running .maximizeWindow() protocol action: Unknown command 404 Not Found

1 reply
John Corser
@johnpc

Hello. Because I need shadow DOM interactions, I am looking to combine webdriverIO with Nightwatch. I have Nightwatch set up to connect a remote selenium server (BrowserStack) but following that documentation, wdio does not inherit those rules and instead launches my local chrome. Do I need to build a redundant wdio.conf.json so that webdriverIO points to the same selenium server that nightwatch does?

The documentation states:

The implementation is still in its early stage and we are relying on feedback from the community on how to move forward with this initiative, if it is indeed something that users require. Please feel free to drop us a line on Twitter or on the Gitter Chat.

2 replies
Sumit Saxena
@sumsax
Hi All , I need some help regarding quiting browser after each test case execution I tried with After Each block but it didnt worked - afterEach(browser) {
CommonOperationPage.printMessage('After each...');
browser.end(() => {
   ---- 
});
Sumit Saxena
@sumsax
Hi All , I need some help regarding quiting browser after each test case execution I tried with After Each block but it didnt worked - afterEach(browser) {
CommonOperationPage.printMessage('After each...'); Iam doing browser.end() but its not working with async function based test case
Dipak Acharya
@dpakach

Hi all, I have a Nightwatch test that needs to interact with a user Prompt. I basically need to dismiss the prompt from the tests. From the documentation I can see that we can use dismissAlert() command to do that. But when I try that, I get an error message saying

 Error while running .dismissAlert() protocol action: An attempt was made to operate on a modal dialog when one was not open. – no such alert

Also when I try other commands for user-prompts such as getAlertText(), I get similar error messages

 Error while running .getAlertText() protocol action: An attempt was made to operate on a modal dialog when one was not open. – no such alert

{
  status: -1,
  state: '',
  code: '',
  value: {
    message: 'no such alert',
    error: [
      '  (Session info: chrome=81.0.4044.138)',
      '  (Driver info: chromedriver=81.0.4044.138 (8c6c7ba89cc9453625af54f11fd83179e23450fa-refs/branch-heads/4044@{#999}),platform=Linux 5.4.0-58-generic x86_64)'
    ]
  },
  errorStatus: 27,
  error: 'An attempt was made to operate on a modal dialog when one was not open. – no such alert',
  httpStatusCode: 200
}
rjakech
@rjakech
Hello Team.
How do I exit running nightwatch test from cmd ?
Jinglei Yang
@penguin1214
#2082 for this issue, I'm curious if Nightwatch has switched to full support for W3C Webdriver? I'm using Nightwatch 1.5.1 and facing the issue that waitForElementVisible assertion fail for firefox. And the logs look like Nightwatch doesn't recognize the response from the geckodriver:
   Request POST  /session/ac9863a6-0228-4630-8518-99a95f0f7c9f/elements
   { using: 'css selector',
     value: 'div.navigation' }
   Response 200 POST /session/ac9863a6-0228-4630-8518-99a95f0f7c9f/elements (4ms)
   { value:
      [ { 'element-6066-11e4-a52e-4f735466cecf': '24fe2384-4692-4373-ab65-ef9baaea9367' } ] }
Jinglei Yang
@penguin1214
Does nightwatch behave differently for Mac/Linux?
Sumit Saxena
@sumsax
Hi Team , Iam trying to run nightwatch on local docker but getting this error - bind() failed: Cannot assign requested address (99) error while executing and cannot initiate chrome on port 4444 , anyone having any idea on this
1 reply
Sumit Saxena
@sumsax
@VikasGhorpade , We are also trying to run our nightwatch on aws pipeline but getting chrome 4444 error on launching chrome and even with binding , if possible can we connect how you guys are doing it.
dharls36
@dharls36

Hi. I need to use a defined string in more than one test step, but I don't know how to do this. So in my code I have this in a test step;

'get number value': function (browser) { browser.getText('div:nth-child(1) > .accordion__navigation .trim-level__equipment__heading__count', function (basicEquipmentEntries) { var numberOfBasicEquipmentEntries = (basicEquipmentEntries.value).replace(/\D/g,''); console.log('basic equipment entries = ', numberOfBasicEquipmentEntries); }, 'compare the number value with number of elements': function (browser) { browser.expect.elements('div:nth-child(1) > div.accordion__content.hide ul li').count.to.equal(numberOfBasicEquipmentEntries); };

And I'd also like to use the value of numberOfBasicEquipmentEntries later in the test script.

Is there a way to do this?

Any help would be greatly appreciated. Thanks.

dharls36
@dharls36

Hi.

I'm trying to get the text from the 'content' element of the following html;
<meta name="description" content=“Testing the meta description BMW, 1-Series, Hatchback, 2011">

I'm trying the following in nightwatchjs;

browser.getText('meta[name="description"][content]', function (metaDescription) {
console.log('meta description = ', metaDescription);
});

but it doesn't work. I just get an empty result.

Could someone please help with how to get the text of the 'content' part of the html.

Many thanks.

Kaspar Falkenberg
@Kapaacius
Hello.
I have a very simple and possibly stupid question.
Inside a test, how could I access window object? I have attached a variable from my browser code to it and would need to access it. How could I do that?
dharls36
@dharls36
Hi. I need to get the full selenium (debug) logs when running a test through Nightwatchjs. Any ideas how I go about doing this? Any help would be greatly appreciated. Thanks.
Andrei Rusu
@beatfactor
Selenium or webdriver logs are generated automatically and saved in the current working directory, depending on what service you're using, e.g.: selenium.log, chromedriver.log etc.
Rai Danish
@raidanish

Hi, i was testing dropdown list using CSS selector insight the loop but it throw error
Nightwatch "version": "1.0.0"

browser.url("http://tutorials.actionqa.com/yt/nw/basic/drop-down.html");
for(let i=1 ; i<=4 ; ++i)
{
browser.click('#dropdown option:nth-child(${i})');
browser.pause(2000);
}

Error while running .locateMultipleElements() protocol action: The supplied argument was an invalid selector (e.g. XPath/CSS). – invalid selector: An invalid or illegal selector was s...

Ravi Sawlani
@gravityvi
Hey @raidanish , I think you are using single inverted comma instead of backtick in selector that's causing the trouble
test('sample test',function(browser){
        browser.useCss()
        let page=browser.url('http://tutorials.actionqa.com/yt/nw/basic/drop-down.html')
            for(let i=1 ; i<=4 ; ++i)
            {
            page.click('css selector',`#dropdown option:nth-child(${i})`,function(){
                console.log()
            });
            browser.pause(2000);
            }
    })
Ravi Sawlani
@gravityvi
Hey @dharls36 for getting the text from content you can use getElementProperty function instead
  test('sample test',function(browser){
        browser.useCss()
        let page=browser.url('https://nightwatchjs.org/api/commands/#moveToElement');
        page.getElementProperty('css selector','meta[name=description]','content',(result)=>{
            console.log(['RESULT'],result.value);
        })

})
Rai Danish
@raidanish
@gravityvi thanks
ravikumar2000
@ravikumar2000
@Dharin-shah Related to this github issue on RHEL 7 with nightwatch
https://github.com/nightwatchjs/nightwatch/discussions/2655#discussioncomment-629147?
Dharin Shah
@Dharin-shah
hey @ravikumar2000 selenium is trying to start on 4444 which is already in use, please do note, this is not related to nightwatch
try a different port
ravikumar2000
@ravikumar2000
I tried with 3000 also observed same issues
I was unable to run just curl google.com with night watch in RHEL 7
Shashank Shekhar
@2906shekhar
hey everyone, i've just started working with nightwatch and while using a custom reporter 'https://gist.github.com/denji/204690bf21ef65ac7778' and 'https://www.npmjs.com/package/nightwatch-html-reporter', when it tests/check if the element is present or whether the title is same as mentioned or not it prints it in the following format >> 'Testing if the page title equals 'My Store' (16ms)', where "" is color code in ANSI. does anybody knows how to overcome this?
ravikumar2000
@ravikumar2000

@Dharin-shah I tried with port change to 3000 still no luck
npm@3.10.10 /usr/lib/node_modules/npm
[opc@oci-vm-ravigr nightwatchjs-e2e]$ npx nightwatch tests/google/google.js
Starting selenium server... There was an error while starting the Selenium server:

14:31:49.555 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.10.0', revision: '176b4a9'
14:31:49.556 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 3000
2021-04-19 14:31:49.678:INFO::main: Logging initialized @396ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:31:49.842 ERROR [SeleniumServer.boot] - Port 3000 is busy, please choose a free port and specify it using -port option

[opc@oci-vm-ravigr nightwatchjs-e2e]$ npx nightwatch tests/google/google.js
Starting selenium server... started - PID: 13801

[Google / Google] Test Suite

Running: Demo test Google

Error retrieving a new session from the selenium server

Connection refused! Is selenium server started?
{ value:
{ message: 'session not created: Chrome version must be between 71 and 75\n (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.14.35-2047.502.4.el7uek.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 271 milliseconds\nBuild info: version: \'3.10.0\', revision: \'176b4a9\', time: \'2018-03-02T19:11:12.151Z\'\nSystem info: host: \'oci-vm-ravigr\', ip: \'100.77.44.69\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.14.35-2047.502.4.el7uek.x86_64\', java.version: \'1.8.0_282\'\nDriver info: driver.version: unknown',
error: 'session not created' },
status: 33 }
Appreciate your quick help on this issue

started selenium server with port 3000
[opc@oci-vm-ravigr jar]$ java -jar selenium-server-standalone-3.10.0.jar -port 3000
14:34:00.057 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.10.0', revision: '176b4a9'
14:34:00.058 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 3000
2021-04-19 14:34:00.180:INFO::main: Logging initialized @422ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:34:00.358 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 3000

[opc@oci-vm-ravigr nightwatchjs-e2e]$ npx nightwatch tests/google/google.js
Starting selenium server... started - PID: 14593

[Google / Google] Test Suite

Running: Demo test Google

Error retrieving a new session from the selenium server

Connection refused! Is selenium server started?
{ value:
{ message: 'session not created: Chrome version must be between 71 and 75\n (Driver info: chromedriver=2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926),platform=Linux 4.14.35-2047.502.4.el7uek.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 277 milliseconds\nBuild info: version: \'3.10.0\', revision: \'176b4a9\', time: \'2018-03-02T19:11:12.151Z\'\nSystem info: host: \'oci-vm-ravigr\', ip: \'100.77.44.69\', os.name: \'Linux\', os.arch: \'amd64\', os.version: \'4.14.35-2047.502.4.el7uek.x86_64\', java.version: \'1.8.0_282\'\nDriver info: driver.version: unknown',
error: 'session not created' },
status: 33 }

Ravi Sawlani
@gravityvi
Hey @ravikumar2000 , I think port:3000 is also occupied in your local machine as the logs you showed state Port 3000 is busy, please choose a free port and specify it using -port option
If you are on a mac machine check whether that port is occupied using this command: lsof -i tcp:3000
ravikumar2000
@ravikumar2000

Do i need to run the selenium server with port 30601 & it will be used by
^C[opc@oci-vm-ravigr jar]$ java -jar selenium-server-standalone-3.10.0.jar -port 30602
14:41:28.732 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.10.0', revision: '176b4a9'
14:41:28.733 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 30602
2021-04-19 14:41:28.855:INFO::main: Logging initialized @394ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:41:29.038 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 30602

[opc@oci-vm-ravigr nightwatchjs-e2e]$ curl http://localhost:30602
<!DOCTYPE html>

<html lang="en">

<head>
<meta charset="UTF-8">
<link rel="stylesheet" type="text/css" href="/assets/displayhelpservlet.css" media="all"/>
<link href="/assets/favicon.ico" rel="icon" type="image/x-icon" />
<script src="/assets/jquery-3.1.1.min.js" type="text/javascript"></script>
<script src="/assets/displayhelpservlet.js" type="text/javascript"></script>
<script type="text/javascript">
var json = Object.freeze('{"consoleLink":"/wd/hub","type":"Standalone","hCode":403178209,"version":"3.10.0","class":"org.openqa.grid.web.servlet.DisplayHelpServlet$DisplayHelpServletConfig"}');
</script>
</head>

<body>

<div id="content">
<div id="help-heading">
<h1><span id="logo"></span></h1>
<h2>Selenium <span class="se-type"></span> v.<span class="se-version"></span></h2>
</div>

<div id="content-body">
<p>
Whoops! The URL specified routes to this help page.
</p>
<p>
For more information about Selenium <span class="se-type"></span> please see the
<a class="se-docs">docs</a> and/or visit the <a class="se-wiki">wiki</a>.
<span id="console-item">
Or perhaps you are looking for the Selenium <span class="se-type"></span> <a class="se-console">console</a>.
</span>
</p>
<p>
Happy Testing!
</p>
</div>

<div>
<footer id="help-footer">
Selenium is made possible through the efforts of our open source community, contributions from
these <a href="https://github.com/SeleniumHQ/selenium/blob/master/AUTHORS">people</a>, and our
<a href="http://www.seleniumhq.org/sponsors/">sponsors</a>.
</footer>
</div>
</div>

</body>
</html>[opc@oci-vm-ravigr nightwatchjs-e2e]$ npx nightwatch tests/google/google.js
Starting selenium server... There was an error while starting the Selenium server:

14:41:42.362 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.10.0', revision: '176b4a9'
14:41:42.363 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 30602
2021-04-19 14:41:42.475:INFO::main: Logging initialized @384ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:41:42.641 ERROR [SeleniumServer.boot] - Port 30602 is busy, please choose a free port and specify it using -port option

[opc@oci-vm-ravigr nightwatchjs-e2e]$ lsof -i tcp:30602
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 16814 opc 6u IPv4 60823 0t0 TCP *:30602 (LISTEN)

selenium debug log details
[opc@oci-vm-ravigr nightwatchjs-e2e]$ cat selenium-debug.log
14:40:56.795 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.10.0', revision: '176b4a9'
14:40:56.796 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 30602
2021-04-19 14:40:56.909:INFO::main: Logging initialized @387ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:40:57.094 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 30602
14:40:57.460 INFO [ActiveSessionFactory.apply] - Capabilities are: Capabilities {acceptSslCerts: true, browserName: chrome, chromeOptions: {args: [--headless, --window-size=1920,1080]}, javascriptEnabled: true, name: Google / Google, use_xpath: false}
14:40:57.463 INFO [ActiveSessionFactory.lambda$apply$11] - Matched factory org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService)
Starting ChromeDriver 2.46.628388 (4a34a70827ac54148e092aafb70504c4ea7ae926) on port 26548
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.
[1618843257.496][SEVERE]: bind() failed: Cannot assign requested address (99)
Dharin Shah
@Dharin-shah
@ravikumar2000 use markdown to add your errors and output, this is not readable