How to organize and require code across different files when using casperjs module?
23 views
Skip to first unread message
Howard T
unread,
Dec 1, 2016, 2:14:16 PM12/1/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CasperJS
Hi,
I currently run myfile.js with casperjs ./myfile.js in the CLI but myfile.js has just so many lines of code that I want to split it up across different files. The issue is how might I require different files from the main file and ensure the casper tasks run in the correct order I want them to?
Any advice would be hugely appreciated, thanks.
Best Regards,
Howard
philippe....@oscaro.com
unread,
Dec 6, 2016, 9:13:18 AM12/6/16
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to CasperJS
To split your code in different files you can use
phantom.injectJs('../utils/XXXXX.js');
In XXXXX.js you can define several functions and call them in the main file