Prevent a script from executing in nightwatchjs

28 views
Skip to first unread message

DHarls17

unread,
Jun 25, 2020, 6:08:20 AM6/25/20
to NightwatchJs

I have the following script, within a page, that runs in order to generate a Cookie Policy window;


script.png



what I would like to do, within my nightwatchjs test script, is to stop this particular script within the page html from being run (before the page is loaded). 


This in turn will prevent the CMP window from being displayed on page load (which is my goal).


Any help on how this could be achieved would be greatly appreciated.


thanks





Pieraś

unread,
Jun 25, 2020, 7:01:55 AM6/25/20
to nightw...@googlegroups.com
Maybe my help is faulty but ... is this script available in DOM before the "triggering" action takes place?
It is possible e.g. to modify DOM content in real time but it would be not a real case a bit.

Pieraś

unread,
Jun 25, 2020, 7:06:02 AM6/25/20
to nightw...@googlegroups.com
I think this could be also made the way that you configure browser to disable java scripts at the test run... but of course all scripts if present will not work.

DHarls17

unread,
Jun 25, 2020, 8:24:43 AM6/25/20
to NightwatchJs
Many thanks for your reply. 

Yes, I think configuring the browser to disable java scripts in the test run could work.

I'm afraid I've not done this before, so do you know how I might go about doing this?

thanks

Pieraś

unread,
Jun 25, 2020, 8:35:39 AM6/25/20
to nightw...@googlegroups.com
I've just spent coupld of minutes to google it out but the only "link" in my mind is to change 
in nightwatch.conf.js the browser.options / capabilities - but when looking for available options that can be set I did not find any related to javascript disabling.
I guess we have to wait for someone experienced in this.

--
You received this message because you are subscribed to the Google Groups "NightwatchJs" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nightwatchjs...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nightwatchjs/8ef37b48-e83a-4a96-a8da-dc89a04f35c4o%40googlegroups.com.

davidlinse

unread,
Aug 13, 2020, 4:17:19 PM8/13/20
to NightwatchJs
Since (afaik) Nightwatch does not support intercepting request there is probably not solution for this. 

regards
~david

Naveed Sami

unread,
Aug 6, 2025, 8:50:15 AMAug 6
to NightwatchJs
Reply all
Reply to author
Forward
0 new messages