Commit Graph

65 Commits (d9d2ce73e9167349349fca2d24995d03eced2785)

Author SHA1 Message Date
Leo Franchi 610fb41922 Add support for remotely debugging a script.
This adds a new parameter --remote-debugger-port=<port>. When set,
phantomjs is operating in debug mode and will expose a webkit remote
debugger on the desired port. It can be attached to from any WebKit
browser on the given port and debugged.
2011-11-15 19:02:06 -05:00
Ariya Hidayat f18fd5372f Fix regression of onInitialized.
As suggested by Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>,
there is no need to use queued connection for initialized() slot.

http://code.google.com/p/phantomjs/issues/detail?id=264
2011-10-25 09:48:27 -05:00
Ariya Hidayat fe20c0987d Avoid deleting a QWebPage inside its own signal emission.
If Phantom.exit() is called inside the handler for loadFinished(), we
end up in a situation that QWebPage is deleting itself during a signal
emission. This used to be OK in QtWebKit 2.0 (Qt 4.7) but is not OK for
QtWebKit 2.2 (upcoming Qt 4.8).

http://code.google.com/p/phantomjs/issues/detail?id=251

Patch by Caio Marcelo de Oliveira Filho <caio.oliveira@openbossa.org>.
2011-10-05 17:26:46 -07:00
Ariya Hidayat 2d0e4fc57c Fix copy paste mistake for HTTP authentication.
http://code.google.com/p/phantomjs/issues/detail?id=45
2011-09-16 17:36:27 -07:00
Ariya Hidayat 76de868075 Make HTTP authentication as page settings.
http://code.google.com/p/phantomjs/issues/detail?id=45
2011-09-16 17:34:02 -07:00
Ariya Hidayat 4544b129c9 Improve the API for mouse events.
It now looks like in this example:

  page.sendEvent('mousedown', 42, 217);

Other available events are 'mouseup', 'mousemove', and 'click'. They modelled
after the DOM events.

Unit tests are included.

http://code.google.com/p/phantomjs/issues/detail?id=234
2011-09-16 07:15:21 -07:00
Ariya Hidayat df93935d52 about:blank also needs document.head.
This makes it similar to what a typical web browser does.

http://code.google.com/p/phantomjs/issues/detail?id=235
2011-09-16 07:14:38 -07:00
Ariya Hidayat f73108a1d8 Special handling for about:blank.
http://code.google.com/p/phantomjs/issues/detail?id=235
2011-09-15 00:16:41 -07:00
Ariya Hidayat b0a5b6dbad Every web page gets its own network access manager.
Network-related activites should not be shared between web page
instances. Otherwise, it is extremely confusing when there are two (or
more) web pages are active at the same time.

http://code.google.com/p/phantomjs/issues/detail?id=190
2011-09-14 23:46:01 -07:00
Ariya Hidayat ac9be2a0d4 Sort the include files alphabetically. 2011-09-14 21:47:36 -07:00
Ariya Hidayat d844d5404f Fix wrong viewport size due to commit 6e39625e.
http://code.google.com/p/phantomjs/issues/detail?id=217
2011-09-08 23:40:05 -07:00
Ariya Hidayat f7162f7302 Fix coding style (brace placement and indentation with spaces). 2011-09-08 22:35:07 -07:00
Ivan De Marino d8d88a3894 Added "Copyright..." line to files on which I worked on.
I tried to also add/remove based on the git history.
2011-08-31 16:29:40 +01:00
Ariya Hidayat 66460a7793 Fix building with Qt 4.6. 2011-08-24 05:48:07 -07:00
Ariya Hidayat 6fe972d0a8 Implement WebPage's release() function in pure C++. 2011-08-23 18:53:53 -07:00
Ariya Hidayat 699f4f76f2 Fix coding style (no tab, 4 spaces). 2011-08-20 22:34:11 -07:00
Ariya Hidayat 9d19e02355 Remove stray character in the issue link. 2011-08-20 22:07:18 -07:00
Ariya Hidayat e679640700 Merge branch 'master' of github.com:ariya/phantomjs 2011-08-20 18:13:38 -07:00
Ariya Hidayat 319fd80ec3 Add callback for page initialization.
http://code.google.com/p/phantomjs/issues/detail?id=143
2011-08-20 17:57:01 -07:00
Ariya Hidayat e79a51bdd8 Merge pull request #129 from Roejames12/QWebSettings
New page settings
2011-08-20 17:17:36 -07:00
IceArmy 8880edcf78 Remove settings: jsOpenWindows, jsAccessClipboard, siteSpecificQuirksMode
Renamed jsEnabled to javascriptEnabled
2011-08-20 16:49:36 -07:00
Niek 8deac1b8c6 Fix issue 128 and issue 193 2011-08-20 10:24:56 +02:00
IceArmy 33005c3957 Add a few new QWebSettings for page settings.
Among the most useful, is the jsEnabled setting, which allows you to disable JavaScript.
2011-08-19 15:47:34 -07:00
Rob Terrell 049e1f50bd Added functions to WebPage class to simulate mouse move, mouse up, and mouse down. Also added click() convenience function, which combines a move, mousedown, and mouseup.
Added functions to simulate mouse move, mouse up, and mouse down events
in the Qt layer. For our uses, this was more reliable than creating
mouse events in javascript.
2011-08-07 09:29:50 -04:00
Bartosz Nitka bb2adcc986 Prevent javascript timeout
"The script on this page appears to have a problem. Do you want
to stop the script ?" dialog should no longer show
2011-08-01 17:31:13 -07:00
Kapil Reddy 6e39625ecf added scrollPosition support in c++ version 2011-07-22 13:41:30 +05:30
Ariya Hidayat f25a7a66e5 Bump the Qt requirement to version >= 4.6.
Also, remove code branch for Qt 4.5.
2011-06-26 21:51:30 -07:00
Ivan De Marino 99310e2c47 Curing my _Commentitis_. 2011-06-25 00:16:57 +01:00
Ivan De Marino 2895d096ab Adding "--local-access-remote=[yes|no]".
* This will allow local content to access remote content, bypassing the same origin policy.
* It's controllable from the CLI and through the "page.settings" property
* This addresses Issue #28 but only partially: it's still not possible to make _remote content access other remote content on a different origin_.
2011-06-24 15:57:55 +01:00
Ivan De Marino 9fa0a2c7ce Enabled HTML5 Web App Cache. 2011-06-24 15:28:17 +01:00
Ivan De Marino 6a56c53fba Sorted out a bit the global "QWebSettins".
More stuff to come: I'm working on Issue #28.
2011-06-24 14:54:31 +01:00
Ariya Hidayat 3abb03d638 Build fix for Qt 4.5. 2011-06-20 10:26:32 -07:00
Ariya Hidayat 00810e98b3 Pass source and lineNumber for console redirection.
onConsoleMessage callback can handle two (optional) arguments, e.g.

    page.onConsoleMessage = function (msg, lineNo, source) {
        ....
    };
2011-06-19 21:06:27 -07:00
Ariya Hidayat 6e2b362850 Change scriptLookupDir to libraryPath. 2011-06-17 20:52:19 -07:00
Ivan De Marino 22ee075cc2 Removing "page.click()" for now.
There is need for a discussion to decide how to do this.
2011-06-10 17:08:46 +01:00
Ivan De Marino bd18d7c838 More work on "injectJs"
* "injectJs()" now supports ".coffee" input
* "injectJs()" is now available for the "phantom" object as well
* CSConverter is now a singleton embedded in the Utils static class
* The code used by "injectJs()" is now centralised in the Utils static class
2011-06-10 17:08:46 +01:00
Ivan De Marino cc45aa7f38 Normalie user-provided script path 2011-06-10 17:08:46 +01:00
Ivan De Marino 75403737c4 Added "includeJs()" to "page".
* It includes a script in the page
* It uses a callback to ensure any code dependent on the include runs afterwards
* It uses the signal "javaScriptAlertSent" to do the trick (is there another way to be notified of the "onLoad" event from outside the page context?)
* It uses a "private" slot "_appendScriptElement" to pass the script url in the page context (is there a better way?)
2011-06-10 17:08:46 +01:00
Ivan De Marino a0f8f2491d "loadJsFile()" -> "injectJs"
* According to Issue #32 (http://code.google.com/p/phantomjs/issues/detail?id=32) I added a "lookup logic" that searchs for the file following those steps:
*# Search for file at given path (relative to PWD or absolute - no difference)
*# Is file there? Inject it
*# Is file not there? Try looking for it in "scriptLookupDir"
*# Is file there? Inject it
*# Is file not there? abort
* "scriptLookupDir" is an extra property for WebPage, that, as by it's name, defines a place where to look to script to inject
* Script can alter the scriptLookupDir, if they want
* Updated "injectme.js" accordingly
2011-06-10 17:08:45 +01:00
Ivan De Marino bb0b820f72 Merge remote-tracking branch 'upstream/master' into utilities 2011-06-09 11:50:54 +01:00
Ariya Hidayat 1cae77a3e0 Add 'onResourceReceived' event, fired when resource is being received.
This is now being used in the netsniff.js example.
2011-06-08 01:10:00 -07:00
Ariya Hidayat ea62c17b91 Fix typo, it's C5E and not CSE. 2011-06-07 11:27:10 -07:00
IceArmy 81627896c2 Support every possible PDF format 2011-06-07 10:57:08 -07:00
Ivan De Marino 5b6f2731c4 Added support for "page.click()" and "page.loadJsFile()".
* click() accepts a "querySelectorAll" input - can click on multiple things in one call
* loadJsFile() is synchronous at loading JS in the page
* added 2 examples in JavaScript to show how to use (and test) the new methods
* NOTE: someone will have to generate the .coffee version - I tried using "http://ricostacruz.com/js2coffee/" but it hangs and I'm not willing to learn why :P - I don't like Coffee Script.
2011-06-07 17:20:22 +01:00
Ariya Hidayat 8722399c0a Add "onResourceRequested" event, fired when request is started.
To see how this is being used, see the new examples/netsniff.js.

http://code.google.com/p/phantomjs/issues/detail?id=2
2011-06-07 00:06:08 -07:00
Ariya Hidayat c8504f6994 Introduce "onLoadFinished" event, fired when loading is completed.
It is now possible to specify only the URL in the open() function.
The loading callback can be set using onLoadFinished.

Example use:

    var page = new WebPage();
    page.onLoadFinished = function () {
        console.log("Done!");
        phantom.exit();
    };
    page.open("http://example.com");
2011-06-06 01:40:17 -07:00
Ariya Hidayat d9d9d5a8ac Introduce 'onLoadStarted' event which will fire upon page loads.
An example use:

      var page = new WebPage();
      page.onLoadStarted = function() {
          console.log('start loading...Please wait');
      };
      page.open("http://example.com", function (status) {
          console.log('Done ' + status);
          phantom.exit();
      });
2011-06-06 01:39:24 -07:00
Ariya Hidayat f8b9c322ea Bring back file upload support.
Instead of using command-line option, file can be uploaded using
WebPage.uploadFile function, e.g.:

  var page = new WebPage();
  page.open(....., function () {
      page.uploadFile('input#attachment', '/path/to/file');
  });

uploadFile() accepts selector name (first argument), this is used to identify
which input element will need the filename (second argument).
2011-06-05 00:34:27 -07:00
IceArmy 69ff230f3a Revert "Fix bug where WebPage.evaluate had a syntax error."
This reverts commit d2c520a777.
2011-06-01 12:14:20 -07:00
IceArmy d2c520a777 Fix bug where WebPage.evaluate had a syntax error.
It now creates a proper anonymous function (which passes this for global context)
2011-06-01 02:09:07 -07:00