phantomjs

grunt not running QUnit tests on phantom

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-17 20:22:34
问题 I've got a repository which is integrated with travis. I've got QUnit tests which I'd like to run from grunt/node server side and AMD (requirejs). This is the source of my AMD init.js: (function () { require.config({ baseUrl: "../src" }); require(["../test/suites/basic", '../test/qunit-extend', 'qunit' ], function(BasicTests) { QUnit.config.autoload = false; QUnit.config.autostart = false; BasicTests.run(); QUnit.load(); QUnit.start(); }); }()); When I run those QUnit tests within my browser

grunt not running QUnit tests on phantom

风格不统一 提交于 2019-12-17 20:15:41
问题 I've got a repository which is integrated with travis. I've got QUnit tests which I'd like to run from grunt/node server side and AMD (requirejs). This is the source of my AMD init.js: (function () { require.config({ baseUrl: "../src" }); require(["../test/suites/basic", '../test/qunit-extend', 'qunit' ], function(BasicTests) { QUnit.config.autoload = false; QUnit.config.autostart = false; BasicTests.run(); QUnit.load(); QUnit.start(); }); }()); When I run those QUnit tests within my browser

Using multiple page.open in one script

北城以北 提交于 2019-12-17 20:02:32
问题 My goal is open many pages(with a short delay) and save my data to a file. But my code does not work. var gamesList = [url1,url2,url3]; //gamesList is getting from a file var urls = []; var useragent = []; useragent.push('Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14'); useragent.push('Opera/9.80 (X11; Linux x86_64; U; fr) Presto/2.9.168 Version/11.50'); var page = require('webpage').create(); page.settings.userAgent = useragent[Math.floor(Math.random() * useragent.length)];

08.Python网络爬虫之图片懒加载技术、selenium和PhantomJS

僤鯓⒐⒋嵵緔 提交于 2019-12-17 18:17:51
引入 今日概要 图片懒加载 selenium phantomJs 谷歌无头浏览器 知识点回顾 验证码处理流程 今日详情 动态数据加载处理 一.图片懒加载 什么是图片懒加载? 案例分析:抓取站长素材http://sc.chinaz.com/中的图片数据 #!/usr/bin/env python # -*- coding:utf-8 -*- import requests from lxml import etree if __name__ == "__main__": url = 'http://sc.chinaz.com/tupian/gudianmeinvtupian.html' headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36', } #获取页面文本数据 response = requests.get(url=url,headers=headers) response.encoding = 'utf-8' page_text = response.text #解析页面数据(获取页面中的图片链接) #创建etree对象 tree =

Parse output of spawned node.js child process line by line

て烟熏妆下的殇ゞ 提交于 2019-12-17 17:36:18
问题 I have a PhantomJS/CasperJS script which I'm running from within a node.js script using process.spawn() . Since CasperJS doesn't support require() ing modules, I'm trying to print commands from CasperJS to stdout and then read them in from my node.js script using spawn.stdout.on('data', function(data) {}); in order to do things like add objects to redis/mongoose (convoluted, yes, but seems more straightforward than setting up a web service for this...) The CasperJS script executes a series of

爬虫——Selenium与PhantomJS

偶尔善良 提交于 2019-12-17 17:02:52
Selenium Selenium是一个Web的自动化测试工具,最初是为网站自动化测试而开发的,类型像我们玩游戏用的按键精灵,可以按指定的命令自动操作,不同的是Selenium可以直接运行在浏览器上,它支持所有主流的浏览器(包括PhantomJS这些无界面的浏览器)。 Selenium可以根据我们的指令,让浏览器自动加载页面,获取需要的数据,甚至页面截屏,或者判断网站上某些动作是否发生。 Selenium自己不带浏览器,不支持浏览器的功能,它需要与第三方浏览器结合在一起才能使用。但是我们大多数时候需要让它内嵌在代码中运行,所以我们可以用一个叫PhantomJS的工具代替真实的浏览器。 可以从 PyPI 网站下载 Selenium库 https://pypi.python.org/simple/selenium ,也可以用 第三方管理器 pip用命令安装: pip install selenium Selenium 官方参考文档: http://selenium-python.readthedocs.io/index.html PhantomJS PhantomJS是一个基于Webkit的“无界面”(headless)浏览器,它会把网站加载到内存并执行页面上的JavaScript,因为不会展示图形界面,所以运行起来比完整的浏览器要高效。

RemoteWebdriver started with PhantomJS does not open https url

馋奶兔 提交于 2019-12-17 16:59:33
问题 I am using selenium with PhantomJs to scrape the URL. I initialized the driver as below final DesiredCapabilities caps = DesiredCapabilities.chrome(); caps.setCapability( PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, "PhantomJsPath"); caps.setCapability("page.settings.loadImages", false); caps.setCapability("trustAllSSLCertificates", true); RemoteWebDriver driver = new PhantomJSDriver(caps); driver.setLogLevel(Level.OFF); driver.get("https://.......") The pagesource obtained from

Network capturing with Selenium/PhantomJS

♀尐吖头ヾ 提交于 2019-12-17 14:01:08
问题 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

Phantom JS synchronous AJAX request : NETWORK_ERR: XMLHttpRequest Exception 101

为君一笑 提交于 2019-12-17 12:14:08
问题 I am making a synchronous ajax call ( ajax settings async: false ). This works well. Now I'm trying to write an automated test for this in phantomJS and I'm getting this error NETWORK_ERR: XMLHttpRequest Exception 101 I checked my service logs and it seems like service is not getting any request. 回答1: Try disabling the web security by using the command-line option --web-security=no when running your script. ( phantomjs --web-security=no yourscript.js ) From the PhantomJS reference (http:/

How to print html source to console with phantomjs

依然范特西╮ 提交于 2019-12-17 10:54:47
问题 I just downloaed and installed phantomjs on my machine. I copy and pasted the following script into a file called hello.js: var page = require('webpage').create(); var url = 'https://www.google.com' page.onLoadStarted = function () { console.log('Start loading...'); }; page.onLoadFinished = function (status) { console.log('Loading finished.'); phantom.exit(); }; page.open(url); I'd like to print the complete html source (in this case from the google page) to a file or to the console. How do I