phantomjs

Selenium.PhantomJS is invalid namespace

我的未来我决定 提交于 2019-12-01 23:07:58
I am really trying my best to find a way to web scrape a website using javascript to load the pages so I can scrape lets say my playlist for example. I have had no luck with chrome driver nor phantomjs. Please have a look below and see if you can help me with the error. using OpenQA.Selenium; //The type or namespace 'PhantomJS' does not exist in the namespace 'OpenQASelenium' using OpenQA.Selenium.PhantomJS; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MusicScaper { class TidalScraper { } } My packages.config file

PHP + PhantomJS Rasterize

ぃ、小莉子 提交于 2019-12-01 22:46:16
I'm using PhantomJS 64 bit in my PHP application to dynamically capture an HTML page to be emailed to the user. phantomjs rasterize.js "http://..." /path_to_images/image.png This method works fine when I run the above on the command line but when the PHP script runs the command using exec it fails with no output and returns exit code 11. If I switch it to use the 32 bit phantomJS binary, the command succeeds but fails to load the google JSAPI on the page since with error Reference Error: can't find variable google . This is a problem because not all of the page content is loaded and captured

Handle download dialog box in SlimerJS

我们两清 提交于 2019-12-01 21:51:48
问题 I have written a script that clicks on a link which can download a mp3 file. The problem I am facing is when the script simulates the click on that link, a download dialog box pops up like this: Download Dialog Box Now, I want to save this file to some path of my choice and automate this whole process. I am clueless on how to handle this dialog box. 回答1: Here's a script adapted from this blog post to download a file. In SlimerJS it is possible to use response.body inside the

Log In To Website Using RSelenium & phantomjs in R, Multiple Instances Of Class exist

痞子三分冷 提交于 2019-12-01 21:51:27
问题 I am trying to log in to this page: https://www.optionslam.com/accounts/login/ using the code on this post as a starting point, Scrape password-protected website in R I have been able to populate the login fields, but cannot click on the log in button. If you look at the source of the page, the class of login is "red-button" <input type="submit" value="Log in" class="red-button"/> However, there is another form at the top of the page that also uses the same class, and the clickElement()

Evaluate in PhantomJS doesn't seem to work

时光毁灭记忆、已成空白 提交于 2019-12-01 21:49:50
问题 I have a problem with JavaScript magic. When I execute this code: var page = require('webpage').create(); var url="http://google.com"; page.open(url, function (status){ if (status!== "success") { console.log("Fail to load: "+url) }else{ console.log('1'); page.evaluate(function() { console.log('2'); }); console.log('3'); } phantom.exit(); }); console have only 1 and 3 and no 2. Can anyone say why? If I paste after my code DOM manipulation example (but it never execute) I have my two. Did I

PhantomJS not persisting localStorage consistently

爱⌒轻易说出口 提交于 2019-12-01 21:36:31
I am trying to make an isolated test case to experiment with PhantomJS localStorage behavior, but in my testCase, localStorage does not appear to be persistent. Here is the PhantomJS script: var page = require('webpage').create(); page.open('http://localhost:8080/myapp/test.html', function() { var x; x = page.evaluate(function() { return localStorage.getItem("foo"); }); console.log(x); phantom.exit(); }); When test.html has a call to localStorage.setItem("foo", "bar") the script displays "bar" as i expect. But when I remove the localStorage.setItem call from test.html, the script prints out a

Log In To Website Using RSelenium & phantomjs in R, Multiple Instances Of Class exist

巧了我就是萌 提交于 2019-12-01 21:36:09
I am trying to log in to this page: https://www.optionslam.com/accounts/login/ using the code on this post as a starting point, Scrape password-protected website in R I have been able to populate the login fields, but cannot click on the log in button. If you look at the source of the page, the class of login is "red-button" <input type="submit" value="Log in" class="red-button"/> However, there is another form at the top of the page that also uses the same class, and the clickElement() command is clicking on it. Reading the RSelenium documentation, I can't find a way to either search for the

Evaluate in PhantomJS doesn't seem to work

十年热恋 提交于 2019-12-01 21:35:24
I have a problem with JavaScript magic. When I execute this code: var page = require('webpage').create(); var url="http://google.com"; page.open(url, function (status){ if (status!== "success") { console.log("Fail to load: "+url) }else{ console.log('1'); page.evaluate(function() { console.log('2'); }); console.log('3'); } phantom.exit(); }); console have only 1 and 3 and no 2. Can anyone say why? If I paste after my code DOM manipulation example (but it never execute) I have my two. Did I forget something important? PhantomJS won't log console messages in .evaluate() statements by default.

Use phantomJS in R to scrape page with dynamically loaded content

与世无争的帅哥 提交于 2019-12-01 20:44:21
问题 Background I'm currently scraping product information from some websites in R using rvest. This works on all but one website where the content seems to be loaded dynamically via angularJS (?), so cannot be loaded iteratively e.g. via URL parameters (as I did for other websites). The specific url is as follows: http://www.hornbach.de/shop/Badarmaturen/Waschtischarmaturen/S3584/artikelliste.html Please keep in mind I don't have admin rights on my machine and can only implement solutions that

Nightmare JS not working

て烟熏妆下的殇ゞ 提交于 2019-12-01 18:01:44
I know the title of the question looks very vague! But that's there's to it. I installed nodejs on my production server, which had phantomjs working properly, then I installed nightmare via npm install nightmare , I can see it in node_modules, I tried the example listed by the developers on github: var Nightmare = require('nightmare'); var nightmare = Nightmare({ show: true }) nightmare .goto('http://yahoo.com') .type('input[title="Search"]', 'github nightmare') .click('#uh-search-button') .wait('#main') .evaluate(function () { return document.querySelector('#main .searchCenterMiddle li a')