laurentj / slimerjs Goto Github PK
View Code? Open in Web Editor NEWA scriptable browser like PhantomJS, based on Firefox
Home Page: http://slimerjs.org
License: Other
A scriptable browser like PhantomJS, based on Firefox
Home Page: http://slimerjs.org
License: Other
In PhantomJS, webpage.open() accepts more than two arguments. Our implementation should also accepts same arguments as indicated in the source. We should also indicate it on the documentation of phantomJS
To manage inside web pages, we should implement webpage.uploadFile() and webpage.onFilePicker
we should be able to indicate a configuration file (json format) with a --config=/path/to/config.json parameter
Hello,
I recently updated my Firefox version to 23 which is unsupported yet by slimerjs. As expected, slimerjs is showing an error. Unfortunately, the return code is 0
which confuse the calling script:
$slimerjs && echo success
(process:18232): GLib-CRITICAL **: g_slice_set_config: assertion `sys_page_size == 0' failed
Error: Platform version '23.0a2' is not compatible with
minVersion >= 17.0.0
maxVersion <= 22.*
success
Regards
webpage.navigationLocked, webpage.onNavigationRequested, webpage.navigationRequested(url, navigationType, navigationLocked, isMainFrame)
see webpage.settings and phantom.defaultPageSettings.
The title says all...
Related to the issue #51 : we don't see error messages with this script http://pastebin.com/5LYjrJFv
Error: path does not exist: screenshots/2013715-182656-1280x1024/..
We only see them in the error log file (--error-log-file=error.log)
The title says all....
PhantomJS displays this informations:
Currently (version 0.7) calling slimer.exit(1)
makes the process exit with status 0
. This makes Slimer unsuitable for use as a testing platform since CI servers cannot tell whether the tests failed without relying on a special output format like TAP or XML.
It should be possible to write test scripts with Slimer and use the exit status to indicate failure.
Move some function into the slUtils object.
Through sendEvent or an other function
the title says all
Hi,
When I load the following script,
var page = require('webpage').create();
page.open("http://www.slimerjs.org", function (status) {
console.log('a');
page.evaluate(function() {
var I;
I.will.throw.an.error();
});
console.log('b');
});
it just freezes on the page.evaluate
line and no error message is displayed. This makes debugging scripts quite complicated.
Regards
We should add support for these parameters:
I think values should be stored into preferences
These function is available in loaded web page.
We should support also webpage.onCallback
We should investigate why.
Hi,
Although it is not a documented API of phantomJS, resource.id
in onResourceRequested
and onResourceReceived
starts with 1
. In slimerJS, it starts with 0
.
Regards
Many command line options change preferences. By default preferences are stored automatically so if we launch two instances of SlimerJS, they will share same preferences values even if we don't set same command line options.
Two solutions:
Like page.onResourceReceived,but also support request that flash sent . I want to make webpage snapshoot also support music and videos,which usually are requested in flash.Is it possible to capture request that sent by flash?
Phantomjs create directories indicated in the path givent to render(), if it doesn't exist. SlimerJS doesn't create them.
We should support these parameters:
To support --ssl-certificates-path=/path/to/dir see this code snipet
Even after setting dom.max_script_run_time to 0 in Firefox's about:config message keeps popping up. I think slimerjs should have an option to supress it.
when calling a web page with redirect the callback of open is never called
for example with this script
var webpage = require("webpage").create();
//page with redirect
var url ="http://fr.wikipedia.org/";
webpage.open(url, function(success){
console.log(success);
console.log("loaded "+url);
});
// page without redirect
var url ="http://fr.wikipedia.org/wiki/Wikipédia:Accueil_principal";
webpage.open(url, function(success){
console.log(success);
console.log("loaded "+url);
});
the result is
success
loaded http://fr.wikipedia.org/wiki/Wikipédia:Accueil_principal
the expected result should be
success
loaded http://fr.wikipedia.org/wiki/Wikipédia:Accueil_principal
success
loaded http://fr.wikipedia.org/
In gecko, "javascript:" links are executed asynchronously. The problem is that after clicking on this kind of link, if the script modify something that we want to test after the click, we don't see this modification.
We could patch gecko in nsDocShell to "load" javascript links in an synchronous manner.
Webdriver is a library to support the Selenium protocol. We should include it and support these cli options:
--webdriver or --wd or -w
--webdriver=ip:port
--webdriver-logfile=/path/to/logfile
--webdriver-loglevel=[ERROR|WARN|INFO|DEBUG]
--webdriver-selenium-grid-hub=url
SlimerJS should support
This API should rely on the cookie manager already provided by XulRunner.
In SlimerJS, Cookies are activated by default and are persistant.
We should provide an option:
Note: to deactivate cookies: preference network.cookie.cookieBehavior. 2=disabled, 0=enabled
-
PhantomJS has these options
--remote-debugger-port=number
--remote-debugger-autorun=[yes|no]
They allow to debug a script with web developer tools of Google Chrome / Safari.
We should have similar features, working with developer tools of Firefox.
Hello,
When running two instances of SlimerJS in parallel, you get an error message:
SlimerJS is already running, but is not responding. To open a new window, you must first
close the existing SlimerJS process, or restart your system.
PhantomJS handle this correctly.
Regards
When launching initial-tests.js or main-tests.js on windows (with the slimerjs.bat), there is this error:
Script Error: Module: Can not resolve "./a/b" module required by main located at
file:///C:/Users/xxx/apps/slimerjs/test/main-tests.js
Stack:
-> file:///C:/Users/xxx/apps/slimerjs/test/test-require.js: 19
we should hack nsPrompter.js, to use given authentication parameters instead of displaying a dialog box.
In some CommonJS and JSM modules, we could load some other module only when needed.
In Firefox 22b2 and more (23, 24..), the window object cannot be used any more in a slimerjs script. we have this error from Gecko:
Permission denied to call method on |this|
I tried running slimerjs on Windows Vista 64, from the files in the Standalone Edition (slimerjs-0.8-win32.zip)
But it looks like there is something wrong with the slimerjs.bat file: I get the widows shell "Command syntax error" message (in my locale language):
I tried a bit of debugging and ditched @echo off
and it bails about here
If I look into the .bat file I also see the 5 duplicated if clauses, like here so I wonder if things are as they should be.
I'll poke around a bit and see if I can find out more.
SlimerJS should be able to execute CoffeeScript.
The module loader should be modified to detect .coffee extension, and the CoffeeScript library should be embedded.
We should disable disk cache if --disk-cache=no. Probably a simple preference to set.
By default it is no. So by default we should erase the disk cache at startup. (disk cache is stored in the app profile)
PhantomJS has these options
--local-storage-path=/path/to/file
--local-storage-quota=number
However, SlimerJS support natively local storage: it is stored in the app profile under a specific name, and I'm not sure we can indicate the file name (is it in a pref?)
For quota, probably it is a preference.
We should at least document how to manage profiles
There is also the API webpage.offlineStoragePath webpage.offlineStorageQuota
CasperJS declares the patchRequire function on the window object of the initial script. In PhtanomJS, this function is accessible by other modules. This is not the case in SlimerJS.
Should we break sandboxing behavior of our module system implementation? :-/
slimerjs.bat does not support the -help flag.
ok, I had a look at bin/slimerjs
and it appears to be an arg parser that supplies some text for the -help
or -h
option. The rest of it looks to be setup for the command line
"$SLIMERJSLAUNCHER" -app $SCRIPTDIR/../src/application.ini -purgecaches --envs "$LISTVAR" "$@"
If I've got it right $SLIMERJSLAUNCHER
is the path to xulrunner, $SCRIPTDIR/../src/application.ini
is the full path to slimerjs/src/application.ini
, $LISTVAR
is a comma separated list of environment variable names, and $@
is . . . I don't know exactly, maybe a pseudo variable that returns the arguments supplied to the script? At any rate, I supplied the javascript file name as the last argument. I also tried giving the full path to the script. Nothing I tried worked.
Anyway, on windows I created a batch file to create this command but couldn't get slimerjs to do anything except flash briefly on the screen. Then I changed the command and added the -console
option so I could see any errors that might go to the console and commented out line 51 in slimerjs/src/chrome/slimerjs/content/slimerjs.js
which reads Services.startup.quit(Components.interfaces.nsIAppStartup.eForceQuit);
After doing this the window would stay on screen showing the fancy green ghost and my TrueConsole™ would stay on screen telling me that there was an error on line 34 of slimerjs/src/modules/phantom.jsm
which led me to believe that somehow I had not supplied the script name and location correctly.
So, in order for me to figure this out I'll need to know what information slimer expects to be in $LISTVAR
and what $@
does exactly. I'm figuring that after the program is started everything will be handled by the xulrunner and should work cross platform.
https://github.com/laurentj/slimerjs/blob/master/src/chrome/slimerjs/content/slimerjs.js#L51
https://github.com/laurentj/slimerjs/blob/master/src/modules/phantom.jsm#L34
When clicking on a link target="_blank", with PhantomJS the isMainFrame parameter is false. In SlimerJS, it is true.
The problem is that we don't have any information in navigation.js::shouldLoad, about how the new URI will be loaded.
We could patch gecko, nsDocShell.cpp::InternalLoad, by passing the targetDocshell to NS_CheckContentLoadPolicy as extra parameter.
When we launch slimerjs.bat, we should open a new console window in order to "print" console messages. However, this window is closed immediately after the execution of SlimerJS, and so we don't have time to see messages. We should find a solution for this issue.
if we use a path containing several directory, phantom.injectJs fails. The File Api of Mozilla doesn't like slash in path under windows...
ex: phantom.injectJs('wwwfile/injectslimer.js');
the title says all..
Investigate how Firefox "print" the current page into a pdf.
Hi,
Although not documented in PhantomJS, page.evaluate accept an already stringified function. Here is a test file:
var page = require('webpage').create();
page.open('http://www.google.fr', function() {
try {
var res = page.evaluate('function(){return "ok";}');
} catch(e) {
console.log(e);
}
console.log(res);
phantom.exit();
});
Here are some usage in the wild.
Regards
webpage.customHeaders,
Windows opened by a web page (window.open), could be managed by some functions and properties on the webpage object: ownPages, pages, pagesWindowName, getPage()
With cygwin, the bash script generate a unix path. However, xulrunner.exe/firefox.exe expect a windows path. We should generate a windows path for cygwin. By providing a specific bash script or by improving the current bash script if possible.
title says all.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.