phantomjs

Cannot navigate with casperjs evaluate and __doPostBack function

时间秒杀一切 提交于 2019-12-04 12:09:04
When I try to navigate the pagination on sites with links where href is a __doPostBack function call, I never achieve the page change. I am not sure what I am missing, so after a few hours of messing around I decided to see if someone here can give me a clue. This is my code (uber-simplified to show the use case). var casper = require('casper').create({ verbose: true, logLevel: "debug" }); casper.start('http://www.gallito.com.uy/inmuebles/venta'); // here i simulate the click on a link in the pagination list casper.evaluate(function() { __doPostBack('RptPagerDos$ctl08$lnkPage2',''); }); casper

selenium模块基础用法详解

[亡魂溺海] 提交于 2019-12-04 12:07:15
目录 selenium模块 官方文档 介绍 安装 有界面浏览器 无界浏览器 selenium+谷歌浏览器headless模式 基本使用 选择器 基本用法 xpath 获取标签属性 等待元素被加载 隐式等待 显式等待 元素交互操作 点击,清空 Action Chains 在交互动作比较难实现的时候可以自己写JS(万能方法) frame的切换 其他 模拟浏览器的前进后退 cookies 选项卡管理 异常处理 selenium模块 官方文档 http://selenium-python.readthedocs.io/ 介绍 selenium最初是一个自动化测试工具,而爬虫中使用它主要是为了解决requests无法直接执行JavaScript代码的问题 selenium本质是通过驱动浏览器,完全模拟浏览器的操作,比如跳转、输入、点击、下拉等,来拿到网页渲染之后的结果,可支持多种浏览器 from selenium import webdriver browser=webdriver.Chrome() browser=webdriver.Firefox() browser=webdriver.PhantomJS() browser=webdriver.Safari() browser=webdriver.Edge() 安装 有界面浏览器 selenium+chromedriver #安装

Error registering PhantomJS node in Selenium Grid

谁都会走 提交于 2019-12-04 11:12:03
问题 I have the following problem I successfully launched Selenium Grid hub with: java -jar selenium-server-standalone-2.53.0.jar -role hub After that I tried to launch PhantomJS node with: phantomjs --webdriver=8090 --webdriver-selenium-grid-hub=http://localhost:4444 but got Error: [INFO - 2016-03-25T13:56:28.397Z] GhostDriver - Main - running on port 8090 [INFO - 2016-03-25T13:56:28.397Z] GhostDriver - Main - registering to Selenium HUB 'http://localhost:4444' version: using '127.0.0.1:8090'

How can I change logfile path of phantomjs with selenium?

三世轮回 提交于 2019-12-04 11:09:25
When using phantomjs with selenium, I would like to change the default --webdriver-logfile parameter, that selenium passes to phantomjs. How can I do it? The corresponding line in selenium log: 11:06:06.960 INFO - arguments: [--webdriver=14380, --webdriver-logfile=<ROOT PATH DELETED HERE>/phantomjsdriver.log] Firing up phantomjs in coffeescript: webdriverio = require 'webdriverio' module.exports.World = World = (next) -> @browser = webdriverio.remote({ desiredCapabilities: { browserName: 'phantomjs' "phantomjs.binary.path": "node_modules/phantomjs/bin/phantomjs" }}) .init() next() I was

How to install PhantomJS for use with Python Selenium on the Raspberry Pi?

最后都变了- 提交于 2019-12-04 10:48:43
问题 I want to run a Python script using Selenium WebDriver with PhantomJS as a headless browser on my Raspberry Pi running Raspbian. I originally wrote the script in OS X where it works fine. But in trying to make it work on the Raspberry, I'm having problems. When trying to run the script, I get this error: raise WebDriverException("Can not connect to the Service %s" % self.path) selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /usr/bin/phantomjs Brief

Python Web Scraping (Beautiful Soup, Selenium and PhantomJS): Only scraping part of full page

一笑奈何 提交于 2019-12-04 10:11:04
Hello I am having trouble trying to scrape data from a website for modeling purposes (fantsylabs dotcom). I'm just a hack so forgive my ignorance on comp sci lingo. What Im trying to accomplish is... Use selenium to login to the website and navigate to the page with data. ## Initialize and load the web page url = "website url" driver = webdriver.Firefox() driver.get(url) time.sleep(3) ## Fill out forms and login to site username = driver.find_element_by_name('input') password = driver.find_element_by_name('password') username.send_keys('username') password.send_keys('password') login_attempt =

PhantomJS sometimes gives “parse error” messages

余生颓废 提交于 2019-12-04 09:39:41
Our company wants to start triggering our QUnit unit tests through our CI server and are looking at PhantomJS as a means of achieving this goal. We started by just trying to open a couple of our QUnit test pages in phantom via the following script: var page = require('webpage').create(); var args = require('system').args; page.onConsoleMessage = function(msg, lineNum, sourceId) { console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")'); }; page.onError = function(msg, trace) { var msgStack = ['ERROR: ' + msg]; if (trace) { msgStack.push('TRACE:'); trace.forEach

Phantomjs integration with Google App Engine

六月ゝ 毕业季﹏ 提交于 2019-12-04 09:35:21
Hi I like to know if it is possible to run phantomjs on Google App Engine. My use case is to use Phantomjs to take snapshots of html pages served on GAE using a cron job. Has this been done before ? Google App Engine supports a number of language runtimes (Java, Python, PHP and Go), but you can use the Managed VMs feature of Google App Engine to run anything in a Docker container (such as PhantomJS), and you can also use Google Compute Engine to get a VM where you can also install anything you would like, in any language. For reference, here's a tutorial for running Node.js on Managed VMs to

How to connect to MongoDB using PhantomJS

随声附和 提交于 2019-12-04 09:20:49
I'm Running OSX. Thought I could find documentation somewhere, but could not. You can use a MongoDB REST client: Sleepy.Mangoose : It's the best IMO MongoDB REST : It looks promising, but is not complete yet and has some weird bugs (for example, it refused to send large requests (more than 80,000 characters) and it took me 3 hours to find what was wrong with it) MongoDB Java REST server You can connect directly to the rest server from you injected javascript (use jQuery's ajax method or simply use xmlhttprequest ), but I think it's better to do it inside PhantomJS's evaluate method (because if

Phantomjs doesn't render footers with a custom styles

北慕城南 提交于 2019-12-04 08:37:50
问题 I have the following example: var page = require('webpage').create(), system = require('system'); if (system.args.length < 3) { console.log('Usage: printheaderfooter.js URL filename'); phantom.exit(1); } else { var address = system.args[1]; var output = system.args[2]; page.viewportSize = { width: 600, height: 600 }; page.paperSize = { format: 'A4', margin: "1cm" footer: { height: "1cm", contents: phantom.callback(function(pageNum, numPages) { if (pageNum == numPages) { return ""; } return "