phantomjs

I cannot get access to the second page by using phantomjs automation

巧了我就是萌 提交于 2019-12-08 10:21:48
问题 I cannot get access to the 2nd page by using phantomjs automation showing an error TypeError: undefined is not an object (evaluating 'r[20].click') undefined:7 :8 while running the phantomjs code console.log("got here"); var page = require('webpage').create(); page.onConsoleMessage = function(msg) { console.log(msg); }; page.open(url, function(status) { if ( status === "success" ) { page.evaluate(function() { document.getElementById("txtLoginName").value = "safvan"; document.getElementById(

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

这一生的挚爱 提交于 2019-12-08 09:08:38
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.php'; page.open(url, function (status) { var js = page.evaluate(function () { return document; });

PhantomJS() not running in pyCharm

梦想的初衷 提交于 2019-12-08 08:56:00
问题 Hi I am trying to PhantomJS() in pyCharm IDE using from selenium import webdriver driver = webdriver.PhantomJS() I have also tried driver = webdriver.PhantomJS(executable_path = "/Path") But every time it gives me error: selenium.common.exceptions.WebDriverException: Message: 'phantomjs' executable needs to be in PATH But this is running absolutely fine in Python 3.6.0 Shell. I have also set the path varible correctly--"C:\PhantomJs\bin\phantomjs\". What could be the problem in pyCharm? 回答1:

Trying to GET from api after posting API issues

旧城冷巷雨未停 提交于 2019-12-08 08:55:49
问题 Hi developers I am back again with a question, I am trying to get some data from this website https://www.iamsterdam.com/nl/uit-in-amsterdam/uit/agenda. First did I crawl the website but when doing that it came to mind that they have a api and that will be a lot faster. So I tried to get the data from the api I tried this: get-website.js: var webPage = require('webpage'); var page = webPage.create(); var settings = { operation: "POST", encoding: "utf8", headers: { "Content-Type": "application

How to use PhantomJS 2.5.0 Beta on Heroku

我只是一个虾纸丫 提交于 2019-12-08 08:34:38
问题 Version 2.5.0 beta of PhantomJS is available for use, but unlike stable versions, there are some dependencies for linux installations. I'm having trouble getting a working version on Heroku. I couldn't find a guide or any real answers in the Google group or elsewhere. How can I go about getting the installation? 回答1: Ultimately, I was able to figure it out! There are a few things that you have to do... TL;DR: heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-apt

Scrape information with form submit using Phantom

混江龙づ霸主 提交于 2019-12-08 08:13:18
问题 I want to do web scraping of this site. I have seen that the APIs are available but, as suggested by duraid in my previous question, it is not advisable to use them. So I tried to use Node.js and Phantom.js with Phantom. This is my code: var phantom = require('phantom'); // object of methods var methods = {}; var loadInProgress = false; var url = 'http://data.un.org/Data.aspx?q=population&d=PopDiv&f=variableID%3A12'; methods.download = async function(req, res) { const instance = await phantom

Fake Flash with PhantomJS & Selenium (Python)

断了今生、忘了曾经 提交于 2019-12-08 07:35:17
问题 found this snippet for faking flash in PhantomJS. I use PhantomJS (2.1.1) through Selenium to do various automated tests. The problem is that the web app I'm testing needs flash support enabled. Therefore I want to simply fake it, so I can still let PhantomJS run headless. My question now is how I should implement the snippet in the above mentioned scenario. My guess right now is that I need to implement it somewhere inside GhostDriver. So hopefully one of you has the right answer for me -

browserify Error : http.createServer is not a function

若如初见. 提交于 2019-12-08 07:26:55
问题 I tried to browserify this node js script : var phantom = require('phantom') phantom.create(function(ph) { ph.createPage(function(page) { page.open("editor.html", function(status) { console.log("opened diagram? ", status); page.evaluate(function() { return document.getElementById("GraphImage").src; }, function(result) { //console.log(result); ph.exit(); }); }); }); }); So I used this command: browserify myscript.js > bundle.js and when I run bundle.js from an html file I get this error: http

How to visit a page several times in a row with PhantomJS?

为君一笑 提交于 2019-12-08 07:16:48
问题 Is it possible to open page, do my things and close it. And after a timeout visit it once again to see the content changes (page has many js functions). Trying to open the page twice in a row makes PhantomJS behave unpredictable. What is the solution then? 回答1: Most the execution in PhantomJS is asynchronous, so you have to open a page only after the first page load was completed: page.open(url, function(){ setTimeout(function(){ // do something page.open(url, function(){ setTimeout(function(

How to get Google's Knowledge Graph “people also search for” content?

倖福魔咒の 提交于 2019-12-08 07:14:44
问题 I'm trying to get Google's "People also search for" content on the search results page and I'm using PhantomJS to scrape their results. However, that Knowledgebase part I need does not show up in the body I get. Does anyone know what I could do to have it shown to me? Here's the code: var phantom = require('phantom'); phantom.create(function (ph) { ph.createPage(function (page) { page.open("http://www.google.com/ncr", function (status) { console.log("opened google NCR ", status); page