phantomjs

How to retrieve the ajax data whose loading requires a mouse click with PhantomJS or other tools

一世执手 提交于 2019-12-08 07:10:39
问题 I'm using PhantomJS to retrieve this page: Target Page Link. The contents I need are under the "行政公告" and "就業徵才公告" tabs. Because this page is written in Chinese, in case you cannot find the tabs, you can use "find" function of the browsers to find the "行政公告" and "就業徵才公告" tabs. Because the contents under the "行政公告" tab are the loaded as the default option, I can easily use the script below to retrieve the page: var page = require('webpage').create(); var url = 'http://sa.ttu.edu.tw/bin/home

Handle multiple users requests to multiple remote web forms using PhantomJS

北慕城南 提交于 2019-12-08 06:56:37
问题 I created a ExpressJS application using NightmareJS which has a form and when we fill form and submit, it sends requests to some remote forms and calculate data and return those results. But the problem is it only works when single client submit the form. When multiple clients submit the form at same time it doesn't work. What could be the reason for this and how to solve this? Front end JS script $(document).ready(function () { $("#calculate-form").submit(function (event) { var request; if

Why can't CasperJS show part of a web site 'outlook.com'?

我与影子孤独终老i 提交于 2019-12-08 06:17:38
问题 I have problem of capturing everything of a web page. After I log in to outlook.com using regular browser, it should show the inbox message in the right side: However, when I use CasperJS, it is just blank. Does anyone have any idea? I have include a temporary login id in the script, you can test it if you can, thanks. Here is the script: var casper = require('casper').create({ verbose: true, logLevel: "info", viewportSize: {width: 1280,height: 720}, pageSettings: {userAgent: "Mozilla/5.0

Phantomjs page.onConsoleMessage doesn't log warnings

回眸只為那壹抹淺笑 提交于 2019-12-08 05:46:17
问题 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

Python | PhantomJS not clicking on element

半城伤御伤魂 提交于 2019-12-08 05:42:22
问题 I have been trying to solve this for an entire week now and this is my last shot at this (asking stackoverflow). I use phantomjs with selenium to go to the login page of YouTube and fill in the credentials and log in. I get to the login page and it manages to fill in the email, but no matter what I try, it won't click on the "next" button. from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.webdriver.common.desired_capabilities import

Closing a window.confirm in protractor with phantomJs

偶尔善良 提交于 2019-12-08 05:40:31
I'm writing E2E tests with Protractor for my AngularJS app. At some point the browser will encounter a window.confirm . When using Chrome as the test browser, the following code works fine : var ptor = protractor.getInstance(); ptor.switchTo().alert().accept(); But on PhantomJS it raises the following error : UnknownError: Invalid Command Method ==== async task ==== WebDriver.switchTo().alert() at tests/E2E/spec/search.spec.js:73:33 ==== async task ==== Asynchronous test function: it() Error at null.<anonymous> (tests/E2E/spec/search.spec.js:63:5) at Object.<anonymous> (tests/E2E/spec/search

Testing React Apps with Phantom/Casper

只愿长相守 提交于 2019-12-08 04:42:47
问题 I'm diving into functional testing and attempting to get a few simple tasks working. The app is built in ReactJS and I've decided to use Phantom/Casper. The problem is that even the most basic tasks fail. In short, is there a trick for testing React apps with Phantom/Casper? I've installed Phantom (v.2.1.1) and Casper (v1.1.0-beta5). As a first attempt I created a simple script to capture an image: capture.js var casper = require('casper').create({ viewportSize: { width: 1024, height: 768 },

Casperjs test if page opens

為{幸葍}努か 提交于 2019-12-08 04:30:42
问题 It can be done with pure phantomjs like this: var page = require('webpage').create(); var address = 'http://google.com/'; page.open(address, function(status) { if (status !== 'success') { console.log('FAIL to load the address'); } else { console.log('SUCCESS'); } phantom.exit(); }); but I'd like it to support casperjs test command. The best I came up with is: casper.test.begin("Hello, Test!", 1, function(test) { var page = require('webpage').create(); var address = 'http://google_doesnotexist

Webdriver phantomjs no longer following link on click

青春壹個敷衍的年華 提交于 2019-12-08 04:11:18
问题 I use a simple webdriver phantomjs script to update some adverts on preloved.co.uk. This script worked great until recently, but then started failing with the "Click submitted but load failed" error after the login link was clicked. In accordance with this I updated my version of phantomjs to latest stable, 1.9.7 following the guide here. However, now the login click does not seem to register either, and the page does not reload. The first step is simply getting to login form page. from

Get PHP proc_open() to read a PhantomJS stream for as long as png is created

末鹿安然 提交于 2019-12-08 03:52:59
问题 I had a PHP script that relied on shell_exec() and (as a result) worked 99% of the time. The script executed a PhantomJS script that produced an image file. Then using more PHP that image file was processed in a certain way. Problem was that on occasion shell_exec() would hang and cause usability issues. Reading this https://github.com/ariya/phantomjs/issues/11463 I learnt that shell_exec() is the problem and switching to proc_open would solve the hanging. The problem is that while shell_exec