Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

Added "phantom.loadJs" and "phantom.includeJs", plus more "qDebug" usage #11

Merged
merged 8 commits into from
Apr 10, 2011
Merged

Conversation

detro
Copy link
Collaborator

@detro detro commented Mar 1, 2011

Hi Ariya,
me again with some more code.

I developed a couple of calls that can make JS testing a bit smoother.

phantom.loadJs

This can be extremely useful when you want to run a test and your code depends on some other code to be in.
Examples:

  • your test needs to load a test framework/library BEFORE can run
  • you want to test a specific JS library over a page

phantom.includeJs

This instead is just a <script> tag injection. It allows to pass an eventHandler that will be executed when the script has been loaded.

Let me know what do you think.
Ivan

* 'phantom.simulateMouseClick' accepts a 'selector' and clicks on every element that matches the selector
* Added a couple of 'qDebug()' to help debugging PhantomJS
* "phantom.loadJs()" loads a JS file and executes it's content within the current Document Context. It's synchronous.
* "phantom.includeJs()" adds a <script> tag include. It's asynchronous and accepts as second parameter a "callback", fired when the js file has been loaded.
* Some more qDebug() calls
* qDebug() output disabled by default in the .pro file

NOTE: I'm adding qDebug() calls to make development of phantomjs easier and "debuggable"
…rce".

Also:
* I added a couple of "qFatal" where it makes sense.
* Usage now mentions the fact that the input files that finish by ".coffee" are also acceptable
@ariya ariya merged commit ce07e12 into ariya:master Apr 10, 2011
@andronick83 andronick83 mentioned this pull request Mar 15, 2013
This was referenced Jul 1, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants