laurentj / slimerjs

A scriptable browser like PhantomJS, based on Firefox
http://slimerjs.org
Other
3k stars 258 forks source link

bug slimerjs #660

Open ThiagoHCAlves opened 6 years ago

ThiagoHCAlves commented 6 years ago

versions

Steps to reproduce the issue

create html with upload file. create js with casper using slimerjs

casper.then(function () { this.page.uploadFile('input[type="file"]', '/Users/thiagohenrique/Downloads/test.txt'); });

Actual results:

phantomjs works fine. slimerjs doesn't work

Expected results:

same result in slimerjs as phantomjs.

laurentj commented 6 years ago

Please, be sure the bug is not in CasperJS. Provide a test script without using CasperJS.

ThiagoHCAlves commented 6 years ago

html

<!DOCTYPE html>

Select image to upload:

js

var casper = require('casper').create({ verbose: true, logLevel: 'debug', pageSettings: { userAgent: 'Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/32.0.1667.0 Safari/537.36', loadImages: true, // The WebPage instance used by Casper will loadPlugins: true // use these settings }, viewportSize: { width: 1920, height: 770 } });

casper.on('remote.message', function (msg) { this.echo('remote message caught: ' + msg); });

casper.on("page.error", function (msg) { this.echo("Page Error: " + msg, "ERROR"); });

casper.start('http://localhost/thiago.php');

casper.then(function () { this.wait(5000); });

casper.then(function () { this.echo(this.page.uploadFile('input[type="file"]', '/Users/thiagohenrique/Downloads/test.txt')); });

casper.then(function () { this.wait(3000); });

casper.then(function () { this.capture('test.png'); });

casper.then(function () { this.wait(5000); });

casper.run();

command line casperjs --engine=slimerjs thiago.js doesn't work casperjs thiago.js work

laurentj commented 6 years ago

Your example is using CasperJS. I would like an example that is using the API of Slimerjs, not CasperJS.

ThiagoHCAlves commented 6 years ago

i need the casperjs using slimerjs as a engine. phantomjs as engine works fine. but when change for slimerjs doesn't work ? how can I solve my problem?

laurentj commented 6 years ago

To avoid problems, always use a stable Firefox version (your are using a deprecated unstable version of Firefox!) which is working with the corresponding version of SlimerJS.

SlimerJS 0.10.3 does not work with Firefox 53+.

Try SlimerJS 1.0-beta.1 with Firefox 57. https://download.slimerjs.org/releases/1.0.0-beta.1/