phantomjs

(转载)Selenium + Chrome headless 报ERROR:gpu_process_transport_factory.cc(1007)]

萝らか妹 提交于 2019-12-03 11:48:28
Selenium不再推荐使用PhantomJS,会报如下警告 UserWarning: Selenium support for PhantomJS has been deprecated, please use headless versions of Chrome or Firefox instead warnings.warn('Selenium support for PhantomJS has been deprecated, please use headless ' 于是从PhantomJS转移到Chrome,使用headless versions of Chrome时,首先要安装Chrome,然后下载chromedriver,再把chromedriver的地址配置到系统环境变量path中,方便调用。如果不把chromedriver的地址配置到系统环境变量的话,也可以在使用时指定chromedriver的地址。 注意Chrome和chromedriver有版本对应的要求,系统中安装了某一版本的chrome要使用对应版本的chromedriver,其实下载最新版本的Chrome和chromedriver就行了,一般都是对应的。 Chrome下载地址:https://chrome.en.softonic.com/ chromedriver下载地址:http://npm

mocha init timeout with mocha-phantomjs

不羁岁月 提交于 2019-12-03 11:38:44
I have the following testrunner.html : <html> <head> <title>Specs</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="/content/css/mocha.css" /> <script> function assert(expr, msg) { if (!expr) throw new Error(msg || 'failed'); } </script> <script src="/client/lib/require.js" type="text/javascript" data-main="/client/specs/_runner.js"></script> </head> <body> <div id="mocha"></div> </body> </html> The _runner.js looks like this: // Configure RequireJS require.config({ baseUrl: '/client', urlArgs: "v=" + (new Date()).getTime() }); // Require

Karma, PhantomJS and es6 Promises

那年仲夏 提交于 2019-12-03 10:31:53
问题 I am writing a JavaScript library that uses the new es6 promises. I can test the library in Firefox because promises are defined. However, when I try to test my code with Karma and PhantomJS, I get the error Can't find variable: Promise. . I am guessing this is because the PhantomJS browser doesn't support es6 promises yet. How can I configure Karma to bring in the polyfill for promises? 回答1: You can pull in the Babel polyfill by simply installing Babel Polyfill: npm install --save-dev babel

win10无法运行phantomjs

戏子无情 提交于 2019-12-03 10:19:14
@参考文章 echarts利用phantomjs将 图片保存到电脑,在win7下好好的,在win10下报错: 'phantomjs' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 在win7下没有配置环境变量,在win10下需要配置环境变量。虽然我win10账有管理员权限,配置系统环境变量仍不起作用。 最后在用户环境变量配置成功。配置到phantomjs的bin目录即可 来源: https://www.cnblogs.com/yanan7890/p/11790693.html

PyCharm unable to connect to GhostDriver

扶醉桌前 提交于 2019-12-03 09:54:46
I have a unit test that is passing when I run it via python manage.py test , but failing when I run it from within PyCharm. def test_alpha(self): from selenium.webdriver.common.utils import free_port from selenium import webdriver driver = webdriver.PhantomJS(executable_path=PHANTOMJS_PATH, port=free_port()) driver.quit() The exception I get when running from PyCharm is WebDriverException: Message: 'Can not connect to GhostDriver' I've spent a fair amount of time digging into this problem, and I've noticed that when I specify a port manually the test passes within PyCharm. # suppose 50000

Phantomjs page.onConsoleMessage doesn&#039;t log warnings

匿名 (未验证) 提交于 2019-12-03 09:52:54
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using Phantomjs to detect errors/warnings on my pages by hooking console messages : page.onConsoleMessage = function(msg, line, source) { console.log(msg); } page.open(page.address, function (status) { if (status !== 'success') { console.log('Fail to load the address'); } else { for(var i=0;i<page.errors.length;i++) { console.log(page.errors[i]); } } phantom.exit(); }); It works fine with the errors, but it does not record the warnings. By errors and warnings, I mean what Chrome console displays in red/yellow. Is there a way to do it in

Cannot install phantomJS in Karma

Deadly 提交于 2019-12-03 09:28:04
WARN [config]: config.configure() is deprecated, please use config.set() instead. WARN [plugin]: Cannot find plugin "karma-phantomjs". Did you forget to install it ? npm install karma-phantomjs --save-dev INFO [karma]: Karma v0.10.2 server started at http://localhost:9018/ WARN [launcher]: Can not load "PhantomJS", it is not registered! Perhaps you are missing some plugin? Getting this error. When running npm install karma-phantomjs --save-dev I get an error. npm ERR! 404 'karma-phantomjs' is not in the npm registry. I installed karma-phantomjs-launcher --save-dev but i still get an error when

TypeError: undefined is not a constructor

£可爱£侵袭症+ 提交于 2019-12-03 09:25:08
I'm very new to Angular and I'm trying to figure much of this out still. I'm writing some tests using Angular 1.5.8 which I generated from the Yeoman Generator. Specifically, I'm trying to figure out how to manipulate $httpBackend results (I'm not sure if that's important or not)... In my app.js file I have the following code: .run(['$rootScope', '$location', 'breadcrumbService', function ($rootScope, $location, breadcrumbService) { $rootScope.$on('$viewContentLoaded', function () { jQuery('html, body').animate({scrollTop: 0}, 200); }); $rootScope.isEditMode = false; $rootScope.$on('

Npm installs fails on cloudbees jenkins

匿名 (未验证) 提交于 2019-12-03 09:13:36
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: With a strange checksum error, And I can't figure what's wrong. it happens both when I installed Npm and node as cloudbees support suggested and when I used node-js-jenkins plugin. both when using -g and not using -g flag. what's wrong? getting this log: > Unpacking http : //nodejs.org/dist/v0.11.7/node-v0.11.7-linux-x64.tar.gz > to > /scratch/ jenkins / tools / jenkins . plugins . nodejs . tools . NodeJSInstallation / node_0 . 11.7 > on s - 68b3777c $ > /scratch/ jenkins / tools / jenkins . plugins . nodejs . tools .

How to reduce phantomjs memory consumption?

◇◆丶佛笑我妖孽 提交于 2019-12-03 09:11:13
问题 I'm using phantomjs with casperjs to run multiple tests and it looks like each instance of PhantomJS takes ~106M of RAM. Is it possible to reduce that amount? Is there a simple way to run tests in multiple "tabs"? 回答1: Edit: As pointed by @newfurniturey, release is now deprecated. We must use close : http://phantomjs.org/api/webpage/method/close.html Don't know if that helps, but the release function could be a good tail : http://phantomjs.org/api/webpage/method/release.html Releases memory