Commit Graph

302 Commits (fa4391d514ee5abb375d9726449122ef4ee334b3)

Author SHA1 Message Date
IceArmy 7418a84e60 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. 2011-08-19 16:32:14 -07:00
IceArmy 9e4830d44c Move pdf_dpi to better location 2011-08-19 16:32:14 -07: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
IceArmy 80ed81a3f9 Regenerate resources 2011-08-19 00:08:02 -07:00
IceArmy 0159c0ed27 Use updated FS api
Fix bug where File.m_file didn't exist in __del__() if we used File.close() first
fs.removeTree now removes tree as well as all tree contents (files). This is for a functionality sync between PhantomJS and PyPhantomJS
All tests will now pass successfully
2011-08-19 00:07:24 -07:00
IceArmy 7cbd75a400 Make the parents the first argument (since we will always supply the arg, and also for cleanliness and order) 2011-08-18 14:23:58 -07:00
IceArmy d70ca4bf7c Updated the network access manager to use a proxied reply so the response bodies can be captured. 2011-08-18 14:09:21 -07:00
IceArmy 3c91c581bb Use new style class for MessageHandler 2011-08-15 13:37:37 -07:00
IceArmy 414660b41a Replace escaped quotes in strings 2011-08-15 11:56:39 -07:00
IceArmy 548e063231 Regenerate resources 2011-08-08 15:13:48 -07:00
IceArmy 862dc6e017 Update CoffeeScript to 1.1.2 2011-08-08 15:12:57 -07:00
IceArmy 12d36a195a Don't require \ at the end of multiline imports 2011-08-01 19:13:19 -07:00
IceArmy 6154876a42 Replace all single quoted strings with escaped single quotes inside with a double quoted string to avoid needing to escape the single quotes 2011-08-01 19:10:04 -07:00
IceArmy 7fe267341a Pass app back to Phantom 2011-07-31 03:05:06 -07:00
IceArmy 9d66ddf5ad Simplify cookies file check 2011-07-31 03:05:06 -07:00
IceArmy 8a9c95d872 Simplify cookiejar code 2011-07-29 05:59:52 -07:00
IceArmy 4ffd835cb3 Persistent cookie support 2011-07-29 03:55:52 -07:00
IceArmy c9ad2c35a7 Correctly handle KeyError/ValueError exceptions on scrollPosition setter 2011-07-29 02:12:12 -07:00
IceArmy 56939bc153 Simplify clipRect code 2011-07-29 02:11:55 -07:00
IceArmy 4440397ef4 Remove useless .keys() method call in for loops 2011-07-29 01:59:50 -07:00
IceArmy df5ac1d9c3 Rename m_webPage.scrollPosition to m_webPage.m_scrollPosition
Fix bug where m_scrollPosition is undefined if you read scrollPosition from JS without first setting it
2011-07-29 01:56:37 -07:00
IceArmy 403572b633 Stop using globals() on scrollPosition() 2011-07-29 01:52:53 -07:00
Kapil Reddy 7641e4e1a4 Renamed pageScroll to scrollPosition 2011-07-11 12:17:40 +05:30
Kapil Reddy 983518d913 Added pageScroll property to webPage for javascript and changed renderImage code to render webpage considering scroll 2011-07-08 14:29:10 +05:30
IceArmy 0d513a4d0b Regenerate resources 2011-07-04 11:07:23 -07:00
IceArmy d1c418ba07 Allow constructs such as: page.open(url, operation) 2011-07-04 11:06:34 -07:00
IceArmy b7fb218473 Improve plugin system
Thanks to frame hacks, we can get rid of passing/modifying locals()
- Passing bunched locals() is no longer needed on the hook points
- You can access the parent namespace with get() instead
- You can change stuff in the parent namespace with set()
2011-07-04 02:48:10 -07:00
Roejames12 75dc3705b9 Remove redundant 'install' section in setup.py 2011-07-04 00:25:35 -07:00
Roejames12 8cfdb0619a Improved README and INSTALL files 2011-07-04 00:22:25 -07:00
IceArmy 78c984d6bf Stop messing with the global namespace on clipRect and viewportSize 2011-07-03 23:16:51 -07:00
IceArmy f83d706f80 Made a custom console script for PyPi since the autogenerated one failed. 2011-07-03 01:36:48 -07:00
IceArmy 00f21213b8 Add homepage URL and license information 2011-07-03 00:07:01 -07:00
IceArmy 97966e8fe8 Remove unneeded del statement. 2011-07-02 17:33:18 -07:00
IceArmy d12202f0a6 More efficient handling of exit() deletion of pages 2011-07-02 17:26:06 -07:00
IceArmy 5218ab7e76 Delete page references on exit() 2011-07-02 17:10:28 -07:00
IceArmy 11ff154145 Regenerate resources 2011-07-02 17:10:28 -07:00
IceArmy 895923603f Fix memory issues by providing a way to truly delete WebPages. #154
Use page.destroy() to delete the page and regain the memory.
2011-07-02 17:08:06 -07:00
IceArmy edf6bc1d98 Remove unneeded is checks 2011-07-01 12:16:07 -07:00
IceArmy d829a2ddc3 Add link versions of fs API 2011-06-30 01:14:29 -07:00
IceArmy bd44efa3f3 Fix fs.changePermissions to not reset file permissions then add changed ones on
It now only changes what you specify to change, correctly.
2011-06-29 23:12:55 -07:00
IceArmy a0a79e4ddc Make fs.join() able to take unlimited paths as per spec.
This however now requires us to pass an array.
E.g. fs.join(['pathA', 'pathB', 'pathC'])
2011-06-29 21:58:18 -07:00
IceArmy 8f79f29659 Add umask, newline, changeGroup, changeOwner, changePermissions, group, owner, permissions 2011-06-29 21:58:18 -07:00
IceArmy 7f67808544 Add hook points to filesystem.py 2011-06-29 05:38:10 -07:00
IceArmy 90eb114cde Add support for TONS of methods defined in CommonJS specs 2011-06-29 05:12:22 -07:00
IceArmy fc81a1e258 Regenerate resources 2011-06-29 02:19:58 -07:00
IceArmy da987ed034 Introducing File I/O API in PyPhantomJS.
* Inspired by HammerJS (see https://github.com/senchalabs/hammerjs)
* Not yet 100% complete
* Final aim is to provide a CommonJS/Filesystem compliant API (see http://wiki.commonjs.org/wiki/Filesystem)
2011-06-29 02:19:08 -07:00
IceArmy bd775fd429 Improve error reporting for injectJsInFrame()
Also changed warnings to debugs
2011-06-29 02:14:50 -07:00
IceArmy a2aed0064c Fix crash on exit (Issues #136, #148 and #149) 2011-06-28 18:41:29 -07:00
IceArmy 67702dbc46 Bump version. 2011-06-26 18:39:03 -07:00
IceArmy 8621e9e4d5 Regenerated resources 2011-06-26 18:28:12 -07:00
IceArmy 2d6fa95171 Fixed issue with the open method that was preventing the use of POST unless a onLoadFinished handler was also passed in. 2011-06-26 18:28:00 -07:00
IceArmy ce065d9fda Improved plugin system
You can now set a priority on a function to control
when it executes for a particular action (hook).
Default priority is 10, but can be changed to anything.

For example, if you have 2 functions hooked to 'Phantom',
you can change one function to priority 12 and leave the other
at 10, so the one at 10 will execute first, no matter where
it is defined.
2011-06-26 18:13:41 -07:00
IceArmy 346f238d7f Enabled HTML5 Web App Cache. 2011-06-24 18:35:56 -07:00
IceArmy 64404a1902 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 18:35:56 -07:00
IceArmy 8064c294b3 Fix loading plugins when program is frozen 2011-06-21 10:46:12 -07:00
IceArmy 75b757226f Regenerate resources 2011-06-21 00:07:16 -07:00
Ariya Hidayat 753ef864b9 Merge pull request #84 from corgibytes/fix-disconnect-this
Correctly disconnected event handler.
2011-06-20 23:59:32 -07:00
IceArmy 49b630bd65 Make sure phantom.exit() really exits. 2011-06-20 23:54:03 -07:00
M. Scott Ford 95a7650be8 Correctly disconnected event handler. 2011-06-20 18:55:05 -04:00
IceArmy 69b06da140 Revert "Exit program properly when we call phantom.exit" 2011-06-20 10:14:08 -07:00
IceArmy d29c6732b5 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 22:34:29 -07:00
IceArmy 1be23d0be9 Regenerate resources 2011-06-19 21:19:01 -07:00
IceArmy 3d0c56af40 Fix the last problem with setTimeout and setInterval 2011-06-19 21:18:14 -07:00
IceArmy 1fb67c49e7 Fix bug where output couldn't be piped/redirected 2011-06-19 18:40:44 -07:00
IceArmy c44838227d Fix bug where phantom.exit wouldn't exit properly 2011-06-19 17:26:39 -07:00
IceArmy 7a9e0c8599 Exit on start script error 2011-06-19 13:37:03 -07:00
IceArmy 56039cae7f Fix issue 131 - 'Properly exit page' causes changed stack trace 2011-06-19 02:49:13 -07:00
IceArmy 9a85d01687 Add newline to CSConverter.convert 2011-06-19 01:23:44 -07:00
IceArmy 11e29fe45c Regenerate resources 2011-06-19 01:23:01 -07:00
IceArmy 0e765f2a95 Exit program properly when we call phantom.exit
Previously, calling phantom.exit would set the exit code and finish running the
JavaScript until it was done, then exit the program with your code. Basically
it didn't actually exit the program. It caused many code fallthrough problems,
but is now fixed. :)
2011-06-19 01:20:45 -07:00
Ariya Hidayat 6e2b362850 Change scriptLookupDir to libraryPath. 2011-06-17 20:52:19 -07:00
IceArmy d78b481777 Regenerate resources 2011-06-17 01:04:40 -07:00
IceArmy 520010fab8 Simplify bootstrap defineSetter code into function 2011-06-17 01:04:19 -07:00
IceArmy 9ed0c2951e On Coffee convert error, just warn and return nothing.
The reason for this is for consistencies sake. When we have a JavaScript
evaluation error, it shows the error, but doesn't exit the program.
Since we can inject CoffeeScripts as well as JS, it wouldn't be
consistent to exit the program. So we just warn instead.
2011-06-16 21:30:10 -07:00
IceArmy e52ed4a54a Report CoffeeScript compile errors 2011-06-16 17:28:36 -07:00
IceArmy 61459fab45 Use phantom.scriptName instead of phantom.args[0] 2011-06-15 14:30:31 -07:00
IceArmy fb99a4868d Merge branch 'master' of https://github.com/ariya/phantomjs 2011-06-15 03:01:10 -07:00
IceArmy c8c58f11c7 Pass script's filename as arg[0] 2011-06-15 02:57:14 -07:00
Francisco Souza 9347cc6fff Created script for running pyphantomjs after install
e.g.: $ pyphantomjs <file>
2011-06-14 19:21:03 -03:00
IceArmy 309d3b5aaa Allow scriptLookupDir to be set for phantom object 2011-06-12 14:38:34 -07:00
IceArmy 25ac6d35ca phantom.injectJs should use the starting scripts directory, not the app directory 2011-06-12 14:04:07 -07:00
IceArmy 233e8cfff9 Fix 'local variable referenced before assignment' in coffee2js() 2011-06-12 13:53:15 -07:00
IceArmy 19b5b31781 Properly load plugins from the app directories plugins subfolder, not from our CWD 2011-06-12 12:50:16 -07:00
IceArmy 6c57775e63 Regenerate resources 2011-06-12 01:23:29 -07:00
IceArmy 6056bc0fa9 Added support for 'injectJs' and 'includeJs'
Updated bootstrap.js to latest. Also contains:
- Fix reference to handlers in onResourceReceived
- Private handlers
- Use closure to make 'handlers' really private.
- Handle onAlert event just like the other events.
- Handle 'onConsoleMessage' event just like the other events.
2011-06-12 01:23:15 -07:00
IceArmy a83d98b654 When sys.exit'ing, don't bother using qCritical, but just sys.exit with the message instead 2011-06-12 01:20:53 -07:00
IceArmy 5ba2bb4e2f Implement cross platform way of finding the Qt4 plugins directory 2011-06-11 01:28:16 -07:00
IceArmy e32ea74eaf Properly work with any directory
Add imageformats folder and dependencies QtXml and QtSvg, to fix problem where files of type jpeg, gif, svg, .., were not supported
Copy directories examples, plugins, over on build.
Copy files README.md, LICENSE, over on build.
2011-06-10 21:17:10 -07:00
IceArmy 6a8da550cb Better timing for onResourceRequested and onResourceReceived.
We record the time right inside the network access manager. This gives
better accuracy than doing it from JavaScript side, no loss due to the
latency of signal slot connection.
2011-06-09 00:30:55 -07:00
IceArmy 5ca07d99ba Expose more properties for onResourceRequested and onResourceReceived. 2011-06-09 00:30:55 -07:00
IceArmy 3c665681f4 Fix possible bug where if CoffeeScript starts with a shebang (hashbang) #!, then // gets put in front of it; but this is not a comment in CoffeeScript, so it causes a problem with the conversion. 2011-06-08 19:00:07 -07:00
IceArmy 91ceec1e9b Add a unique id to associate resource request and receive. 2011-06-08 14:34:30 -07:00
IceArmy 15e596e30c Add hook to handleStarted() 2011-06-08 04:58:20 -07:00
IceArmy d4548b9ad9 Transform all yes,no args into True,False in parseArgs() 2011-06-08 03:14:13 -07:00
IceArmy f0801ad356 Regenerate resources 2011-06-08 03:14:13 -07:00
IceArmy 5c6338c060 Remove encode() from utils.py 2011-06-08 03:14:13 -07:00
IceArmy 0e3b765cc4 Add 'onResourceReceived' event, fired when resource is being received. 2011-06-08 03:13:18 -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
IceArmy f419a958a4 Make build_binary.py able to import no matter what 2011-06-07 09:34:07 -07:00
IceArmy 33f0930d8c Regenerate resources 2011-06-07 02:32:12 -07:00
IceArmy 48704069c2 Enumerate all headers in the HTTP request. 2011-06-07 02:32:12 -07:00
IceArmy 4b3cf65b2e Get away with manual qDebug() since we can use the API now. 2011-06-07 02:32:12 -07:00
IceArmy 8314ad3197 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 02:31:33 -07:00
IceArmy 189703cffc rename setup.py (for building binaries) to build_binary.py 2011-06-06 23:09:06 -07:00
IceArmy ce27e879a2 Setup setup.py information 2011-06-06 22:46:05 -07:00
IceArmy 5f66b1c32b Add AUTHORS file for contributors 2011-06-06 22:31:36 -07:00
Francisco Souza 08c6d232af Added licensing headers to Python files 2011-06-06 23:59:07 -03:00
Francisco Souza bfcc186d93 Using markdown 2011-06-06 23:27:23 -03:00
Francisco Souza 7342d0f818 Merge branch 'master' of https://github.com/ariya/phantomjs 2011-06-06 23:25:39 -03:00
IceArmy 99c62d41ef Regenerate resources 2011-06-06 14:17:13 -07:00
IceArmy d941691f93 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 14:16:48 -07:00
IceArmy 841dc41f41 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 14:15:08 -07:00
IceArmy 435c66c153 Cleanup INSTALL.md 2011-06-05 17:40:27 -07:00
IceArmy 5b04c4e55b Convert README and INSTALL to markdown
Also cleaned them up a bit.
2011-06-05 17:13:03 -07:00
Francisco Souza 42e81c1297 Added INSTALL section just before LICENSING 2011-06-05 20:07:30 -03:00
IceArmy fd95c86d2b Rip out --upload-file command-line option 2011-06-05 16:02:42 -07:00
IceArmy 47acc56153 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 16:02:34 -07:00
Francisco Souza c8dfe1e30a Merge branch 'master' of git://github.com/ariya/phantomjs 2011-06-05 20:00:43 -03:00
Francisco Souza 9ee9361d49 Changes on description, project naming and readme 2011-06-05 20:00:12 -03:00
Francisco Souza 029b7f7768 Using version from utils module 2011-06-05 19:57:29 -03:00
Francisco Souza 9b12ce3f89 Changed the name of package from phantom to pyphantomjs 2011-06-05 19:55:07 -03:00
IceArmy 1796eb5d7c Mark argparse as dependency for Python 2.6 2011-06-04 14:07:51 -07:00
IceArmy fba248781a Reorder import statements as per pep 8 2011-06-03 21:50:13 -07:00
IceArmy a9bf0b964a Move loadStatusChanged signal to top 2011-06-03 15:38:14 -07:00
IceArmy 9b69c83e2a Simplify WebPage signal sending 2011-06-03 15:38:14 -07:00
Francisco Souza e87918c993 Added argparse as dependency for installation 2011-06-03 16:43:26 -03:00
Francisco Souza 47123eff2e Removed setup.py as dependency 2011-06-03 16:32:02 -03:00
Francisco Souza 804ff1bb0b Excluding swp from sdist 2011-06-03 16:30:08 -03:00
Francisco Souza c4ecbbc706 Moving structure for better integration with PyPI 2011-06-03 16:22:58 -03:00
Francisco Souza 7069b707ab Added setup.py and phantom package (for PyPI) 2011-06-03 16:21:03 -03: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
IceArmy 0d78768e4d Fix bug that caused operation body to fail 2011-06-01 00:53:07 -07:00
IceArmy d19901cdf8 Handle badly encoded URL's 2011-06-01 00:29:35 -07:00
IceArmy e93bea5a21 Fix bug where script wouldn't exit properly 2011-05-31 23:29:06 -07:00
IceArmy 82c6735fd0 Declare m_returnValue to 0 2011-05-31 23:29:06 -07:00
IceArmy 456356e876 Simplify CSConverter()'s convert() return statement
Simplify Phantom()'s loadImages and loadPlugins
2011-05-31 22:02:41 -07:00
IceArmy a313d1befd PyPhantomJS version 1.2.0
Refactored most of functionalities to WebPage object
WebPage object can have settings
Support different HTTP operations for loading a page
Simplify buffer handling in render()
Refactor render(), split the buffer rendering to its own function
Render the web page using the tiling approach
WebPage callback for it's console message
Make exit() synchronous
WebPage callback for its JS alert
Updated all examples
2011-05-31 16:23:06 -07:00
IceArmy 73329e73aa Update CoffeeScript to version 1.1.1 2011-05-13 01:10:49 -07:00
IceArmy 652a3c3c76 Added did_action() to find out how many times a hook has been fired 2011-05-07 00:19:55 -07:00
IceArmy e8d1928ebb Fix tiny error where if script is not called directly (so we import it to use it elsewhere), then Bunch and do_action will not be defined in main script. 2011-05-07 00:19:27 -07:00
IceArmy 8c12af3ce5 Did a complete rewrite of the plugin system!
It is now event based, and is MUCH easier than before to write your plugins!
2011-05-06 23:46:51 -07:00
IceArmy 4fc9692176 Get list of .pyc plugins as well, that way you can provide only a bytecode plugin with no .py plugin and it'll still load up fine 2011-05-05 15:43:12 -07:00
IceArmy 66dc5625b3 Raise RuntimeError on loadPlugin's KeyError, explaining the problem 2011-05-05 12:24:30 -07:00
IceArmy e3e82648dd Documented run function(s) and passed args in plugincontroller
Reorganize loadPlugins to run any named function with any set of arguments. all dict arguments will be automatically converted to bunches

Put same func hooks into 1 hook that calls different methods (pre and post)
2011-05-04 23:11:18 -07:00
IceArmy 354bb22a68 Add plugin URL to README 2011-05-04 17:59:17 -07:00
IceArmy 5d861ccdf9 Simplify loadPlugin's bunched globals and locals 2011-05-04 16:52:58 -07:00
IceArmy f320d76284 Simplified plugin code
_globals and _locals are now attributed objects like they should be, instead of being a dict (makes it easier to use them)
2011-05-04 16:15:51 -07:00
IceArmy 15c854405e Add flusher to SafeStreamFilter 2011-05-04 12:32:17 -07:00