phantomjs

Selenium Webdriver PhantomJS C# always opens a cmd window

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to use PhantomJS with Selenium Webdriver in C#. Following is my code: IWebDriver driver = new PhantomJSDriver (); driver . Navigate (). GoToUrl ( "http://www.google.com" ); Console . WriteLine ( driver . Url ); driver . Quit (); The code works fine but whenever it runs, it opens up a cmd window where all the log of the phantomjs is displayed. The cmd is also closed with driver.Quit() . The problem is that I do not want the cmd window to be displayed. What should I do to achieve this? Update: When I do the same code in

how to Execute PhantomJS from PHP

匿名 (未验证) 提交于 2019-12-03 02:44:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to execute PhantomJS from PHP on localhost. Can any body explain how to execute PhantomJS from PHP and what package I should download from phantomjs.org? 回答1: download the PhantomJS binary , upload it somewhere and make it executable ( chmod +x ) if you are going to make screenshots, setup fontconfig (this is pretty specific to my config but the goal is to make sure to have at least some fonts on your system) run the following in PHP: $response = exec('/path/to/phantomjs myscript.js'); 回答2: There's actually a library called PHP

PHP + PhantomJS Rasterize

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using PhantomJS 64 bit in my PHP application to dynamically capture an HTML page to be emailed to the user. phantomjs rasterize.js "http://..." /path_to_images/image.png This method works fine when I run the above on the command line but when the PHP script runs the command using exec it fails with no output and returns exit code 11. If I switch it to use the 32 bit phantomJS binary, the command succeeds but fails to load the google JSAPI on the page since with error Reference Error: can't find variable google . This is a problem because

Angular Router example Best way to upgrade to include .angular-cli.json and bypass Cannot read property 'config' of null

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I tried downloading the Routing and Navigation example from this page Here's the link to the specific zip . I run the following sequence of commands: npm install npm install --save-dev @angular/cli@latest ng -v ng serve -o From what I can make out Cannot read property 'config' of null is somehow related to a bad version of the CLI. But if I create a new project I can start it successfully with my existing setup ng new router cd router npm install ng serve -o Old directory structure (from zip download) includes these files: bs-config.json e2e

getting more information from phantomjs “SyntaxError: Parse error” message

匿名 (未验证) 提交于 2019-12-03 02:29:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have a long script that was not written by me. When i run it I get: phantomjs file.js SyntaxError: Parse error i checked out the manual and --help, and the best i could came up with was: phantomjs --debug=yes file.js (irrelevant debug statement from CookieJar) SyntaxError: Parse error Is there any better way to get at least a line number? or any hint at all? 回答1: Run the file with node . If there is a parse error it will report it. If the file is valid, then node will also try to run it, which will fail if your script depends on something

Network capturing with Selenium/PhantomJS

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I want to capture the traffic to sites I'm browsing to using Selenium with python and since the traffic will be https using a proxy won't get me far. My idea was to run phantomJS with selenium to and use phantomJS to execute a script (not on the page using webdriver.execute_script(), but on phantomJS itself). I was thinking of the netlog.js script (from here https://github.com/ariya/phantomjs/blob/master/examples/netlog.js ). Since it works like this in the command line phantomjs -- cookies - file = /tmp/ foo netlog . js https : /

How to debug PhantomJS when running through Karma

最后都变了- 提交于 2019-12-03 02:20:17
I test through Jasmine, Karma and a variety of browsers. I'm currently debugging a test that fails only in PhantomJS. I'd like to debug this call, so I've setup a custom PhantomJS launcher in karma that runs it with the debug port open. I'm able to access the remote debugger in Chrome through that port, however, it seems to know nothing about any of my test files. It reports an "about:blank" and a "localhost:9876" (the karma server that Phantom is hitting) but when I try to debug that location, it shows none of the source files or Jasmine spec files. Has anyone else seen this behavior? I've

PhantomJS unexpectedly exits on Selenium : WebDriverException with status code 127

匿名 (未验证) 提交于 2019-12-03 02:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using a global PhantomJS on my Mac OS X for multiple Javascript and Python selenium projects. For the first time, I set up a virtual environnement using virtualenv : virtualenv Python3.5 Path/To/MyEnvironnement Then : Path/To/MyEnvironnement . bin/activate which phantomjs ... returns my global selenium : /Users/Me/.npm-packages/bin/phantomjs But every time I call : driver = webdriver.PhantomJS(executable_path=r'/Users/Me/.npm-packages/bin/phantomjs') I get this error : Traceback (most recent call last): File "/Path/To/MyEnvironnement

PhantomJS failing to open HTTPS site

匿名 (未验证) 提交于 2019-12-03 02:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using the following code based on loadspeed.js example to open up a https:// site which requires http server authentication as well. var page = require('webpage').create(), system = require('system'), t, address; page.settings.userName = 'myusername'; page.settings.password = 'mypassword'; if (system.args.length === 1) { console.log('Usage: scrape.js '); phantom.exit(); } else { t = Date.now(); address = system.args[1]; page.open(address, function (status) { if (status !== 'success') { console.log('FAIL to load the address'); } else { t

Cannot find module 'casper' when invoking through PhantomJS

匿名 (未验证) 提交于 2019-12-03 02:18:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I installed PhantomJS in C:\xampp\htdocs\phantom and also I installed CasperJS in this folder C:\xampp\htdocs\casper When I tried to run these sample code on casper site using phantomjs test.js command: var casper=require('casper').create(); casper.start('http://google.fr/'); casper.thenEvaluate(function(term) { document.querySelector('input[name="q"]').setAttribute('value', term); document.querySelector('form[name="f"]').submit(); }, 'CasperJS'); casper.then(function() { // Click on 1st result link this.click('h3.r a'); }); casper.then