CasperJS not executing JS files

413 views
Skip to first unread message

Ben

unread,
Jul 16, 2015, 7:31:20 AM7/16/15
to casp...@googlegroups.com
Hey guys,

I'm trying to create some sort of validation mechanism for our website which checks whether required resources are loaded, etc.

We're using a Tagmanager as central distribution system for loading various Javascripts. Basically we're including a call to a script (x.js) call which then is being evaluated and decides which other JS script files to load and execute.

simplified it looks like this

<html>
   <body>
      <script src="x.js">
   </body>
</html>


<html>
   <body>
      <script src="x.js">
            <!-- x.js get evaluated on document ready and dynamicall loads x1.js, ...  --> 
            <script src="x.1.js">
            <script src="x.2.js">
            <script src="x.3.js">
   </body>
</html>

Problem is that the x.js does not seem to get executed and hence none of the succeeding x.1.js, x.2.js, ... files get requested.

Any ideas on this? Am I missing a config setting?

Cheers,
Ben

Ian B

unread,
Jul 16, 2015, 7:38:59 AM7/16/15
to casp...@googlegroups.com
Have you got close script tags ?

--
CasperJS homepage & documentation: http://casperjs.org/
CasperJS @github: https://github.com/n1k0/casperjs
 
You received this message because you are subscribed to the Google Groups "casperjs" group.
Visit this group at http://groups.google.com/group/casperjs?hl=en.
---
You received this message because you are subscribed to the Google Groups "CasperJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to casperjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Ben

unread,
Jul 16, 2015, 8:06:28 AM7/16/15
to casp...@googlegroups.com
Hey Ian,

thx for the response. As I said, we're just integrating a tag manager script which then loads the rest. This is the page I am talking about: https://www.swisscom.ch/en/residential.html 
If you open it in a browser and check the connections tab in firebug, you see one utag.js file being requested from us. The following utag.xxx.js files are all being loaded automatically by that utag.js file.

If I open this page in CasperJS and check for any of those post-loaded utag.xxx.js files this condition here never seems to fire

casper.waitForResource(/utag\..+\.js/, function () {
   casper.test.pass('Tag loaded');
});

and also if I check in the resource.requested handler I always just see the utag.js file being requested.

Maybe I am missing smoething here in terms of timing since these additional files are only being loaded at the very end on DOM-ready.

Cheers
Message has been deleted

Ben

unread,
Jul 16, 2015, 8:14:34 AM7/16/15
to casp...@googlegroups.com
this is my test suite

casper.test.begin('XXX', function suite(test) {

casper.options.waitTimeout = 30000;

casper.start("https://www.swisscom.ch/en/residential.html", function () {
test.info('Page "' + this.getTitle() + '" loaded ...');
});

casper.waitForResource(/utag\.js/, function () {
console.log('base utag.js loaded');
});


casper.waitForResource(/utag\..+\.js/, function () {
      console.log('other utag tag loaded');
});

casper.run(function () {
test.done();
});
})

Ben

unread,
Jul 16, 2015, 9:31:40 AM7/16/15
to casp...@googlegroups.com
update: this is most likely an issue with our tag management system which only occurs on webkit browsers. so the test should be working fine. will be able to retest it tomorrow

Ben

unread,
Jul 17, 2015, 6:33:26 AM7/17/15
to casp...@googlegroups.com
CLOSED: was an internal issue
Reply all
Reply to author
Forward
0 new messages