laurentj / slimerjs

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

Running CasperJS with SlimerJS in CentOS and Ubuntu Server. Server Environment. #561

Open corderogerardo opened 7 years ago

corderogerardo commented 7 years ago

versions

Steps to reproduce the issue

I have two serversThe initial setup in the server is with no graphical user interface which is normal in Servers for production. Then I follow the steps in the SlimerJS official documentation about installing Firefox, using export to set slimer to firefox. Installing xvfb to run casperjs with slimerjs in headless mode. The command: xvfb-run casperjs caspercaptchaweb.js --engine=slimerjs --debug=true

Actual results:

libGL error: No matching fbConfigs or visuals found libGL error: failed to load driver: swrast 2016-11-30T13:13:20.675Z [DEBUG] Gecko version: 50.0 2016-11-30T13:13:20.675Z [DEBUG] script args: /usr/lib/node_modules/casperjs/bin/bootstrap.js --casper-path=/usr/lib/node_modules/casperjs --cli caspercaptchaweb.js 2016-11-30T13:13:20.676Z [DEBUG] Configuration: debug=true 2016-11-30T13:13:20.676Z [DEBUG] Configuration: Script=/usr/lib/node_modules/casperjs/bin/bootstrap.js 2016-11-30T13:13:20.676Z [DEBUG] Configuration: workingDirectory=/home/devtobmaps JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: SyntaxError: test for equality (==) mistyped as assignment (=)? JavaScript strict warning: coffee-scripts.js, line 8: ReferenceError: reference to undefined property require[a] JavaScript strict warning: file:///usr/lib/node_modules/casperjs/modules/cli.js, line 33: TypeError: variable require redeclares argument JavaScript strict warning: file:///usr/lib/node_modules/casperjs/modules/utils.js, line 32: TypeError: variable require redeclares argument JavaScript strict warning: file:///usr/lib/node_modules/casperjs/modules/casper.js, line 32: TypeError: variable require redeclares argument JavaScript strict warning: file:///usr/lib/node_modules/casperjs/modules/colorizer.js, line 33: TypeError: variable require redeclares argument JavaScript strict warning: file:///usr/lib/node_modules/casperjs/modules/http.js, line 31: TypeError: variable require redeclares argument JavaScript strict warning: file:///usr/lib/node_modules/casperjs/modules/mouse.js, line 33: TypeError: variable require redeclares argument JavaScript strict warning: file:///usr/lib/node_modules/casperjs/modules/pagestack.js, line 33: TypeError: variable require redeclares argument JavaScript strict warning: file:///usr/lib/node_modules/casperjs/modules/tester.js, line 31: TypeError: variable require redeclares argument

Expected results:

With or Withouth XVFB. casperjs caspercaptchaweb.js --engine=slimerjs --disk-cache=no URL http://www.google.com/recaptcha/api/image?c=03AHJ_VusvX6bpCOAbF7Ix4rweQq6rtz5O5yrfsjK-5a6VTQIFooYtOM0i48qozHTH-Af7we9TvJMZmbniajF6uVYuZPdLkWK6zn3d97Lj0Azg7lw5Csn9mDblTRCMMzsmH1NSz9904ZR6H2GBp2MsFiqnuw32xEXSBkQkyX9xQaUQK6AeBDEacp2c7HaIKmTtsu2MswQT2FXB&th=,t0ZXRlGw6aqOGYB5ps22TBzoBI5QWp39AAQVB4md-AEPe-p1FY5QqndchCOaRxlWutGrkewIcAUw-zPt4ys7s-GoZd3SVQwcR4b-aRbfLskULOXfg2QFP1P2XrKr75P5jhZPqIqgJMuBm4iBdVXmYg5ZiAJU_ElJDYR86YkreXboqpfBnzJ9IIhpZN3uvGOR5cRuAce7CMMwvpqbdiJqUBaluxMVfUbyQyNphrSwJE_rSzAO2slGsaQk4pz8qVKqy_oUpGu-B8k1aqeXcIngClYTZnj5gXJhV_H2xLY6Sw5JQMmmQ00q1hC75nP54EJqrRnA2jYZATtmXcWDg-ryjgWIIEkui19qXa4qA-QID3GJpH4dQ9hLb1macpCGUkKZDR18FKBa6kk767F2omJNR2sAFFnIr9cJxONQXpauvy0R1F6tqO9I Download the image Data 1: undefined Captchas Data 2 [ "CaptchaSolutions", "mastercasper.jpg extrem cherry" ] Captchas Data 3 [ "CaptchaSolutions", "mastercasper.jpg extrem cherry" ] These are the captchas data 4 [ { "user": "", "solution": "CaptchaSolutions" }, { "user": "mastercasper.jpg", "solution": "extrem cherry" } ] Solution data 5 "CaptchaSolutions\nmastercasper.jpg extrem cherry" Solution data 6 [ "CaptchaSolutions", "mastercasper.jpg extrem cherry" ] These are the captchas Data 7[ { "usr": "", "solution": "CaptchaSolutions" }, { "usr": "mastercasper.jpg", "solution": "extrem cherry" } ] Data 1 extrem cherry Finish the captcha? Finish the captcha? .

My CasperJS script solves a captcha downloading the image, using another NodeJS Script that solves the captcha image, save it in a file with FS and from CasperJS and FS search for the solution and solve the captcha.

But the error happens with one of my simpler CasperJS script.

I really need to solve this problem. Thank you very much for your help.

laurentj commented 7 years ago

Hi,

the real issue is here:

libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast

If you do a search about these errors, you'll find it is about your operating system and your graphic card drivers and/or graphical environment. I think that if you launch only firefox + xvfb, you'll have the same problem. Probably some packages about Xorg, Nvidia or else are missing.

So I don't think it is related directly with Slimerjs.

Please confirm or unconfirm that assumption.

corderogerardo commented 7 years ago

Hi @laurentj , Thank you. I think you were right I am reproducing the error and confirming! Thank you. I search more about the graphic card and drivers, and test.

I create a Digital Ocean Droplet with Ubuntu 16.04. The drivers are virtual, from Red Hat. 00:02.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 04)

And

*-display UNCLAIMED
description: VGA compatible controller product: QXL paravirtual graphic card vendor: Red Hat, Inc. physical id: 2 bus info: pci@0000:00:02.0 version: 04 width: 32 bits clock: 33MHz capabilities: vga_controller configuration: latency=0 resources: memory:f8000000-fbffffff memory:fc000000-fcffffff memory:fd090000-fd091fff ioport:c0a0(size=32) memory:fd080000-fd08ffff

I think my solution was to install nvidia drivers following the steps here : http://stackoverflow.com/questions/19856192/run-opengl-on-aws-gpu-instances-with-centos

Now I having this error, but that doesn't stop the execution of the script. Crash Annotation GraphicsCriticalError: |[0][GFX1]: Unknown image format 16 (t=2.11583) |[46][GFX1]: Unknown image format 16 (t=9.50428) |[47][GFX1]: Unknown image format 16 (t=9.52044) |[48][GFX1]: Unknown image format 16 (t=9.57078) |[49][GFX1]: Unknown image format 16 (t=10.7873) |[50][GFX1]: Unknown image format 16 (t=11.9564) |[51][GFX1]: Unknown image format 16 (t=13.1855) |[37][GFX1]: Unknown image format 16 (t=9.25451) |[38][GFX1]: Unknown image format 16 (t=9.27129) |[39][GFX1]: Unknown image format 16 (t=9.35333) |[40][GFX1]: Unknown image format 16 (t=9.38703) |[41][GFX1]: Unknown image format 16 (t=9.42036) |[42][GFX1]: Unknown image format 16 (t=9.43752) |[43][GFX1]: Unknown image format 16 (t=9.45367) |[44][GFX1]: Unknown image format 16 (t=9.4708) |[45][GFX1]:

I am going to confirm creating another Droplet in Digital Ocean and test to help more people to be able to work CasperJS with --engine=slimerjs and Xvfb.