phantomjs

How to include JavaScript file in Java program

℡╲_俬逩灬. 提交于 2019-12-07 20:12:54
问题 I have this script file created using phantomjs var webPage = require('webpage'); var page = webPage.create(); page.open(URL, function (status) { var content = page.content; console.log('Content: ' + content); phantom.exit(); }); now I want to use this script in a Java program but I can't. I do this in my project ScriptEngineManager s = new ScriptEngineManager(); ScriptEngine se = s.getEngineByName("JavaScript"); se.eval(new FileReader("myScript.js")); but `this is the result Exception in

getting selenium, ghostdriver, phantomJS working on windows 7

三世轮回 提交于 2019-12-07 18:45:10
问题 I am using selenium-2.34 and phantomJS-1.9.1-windows however when i try to use: import org.openqa.selenium.phantomjs.PhantomJSDriver; import org.openqa.selenium.phantomjs.PhantomJSDriverService; I can see that it does not detect org.openqa.selenium.phantomjs getting this error The import org.openqa.selenium.phantomjs cannot be resolved I was under the impression that GhostDriver was embedded in PhantomJS - https://github.com/detro/ghostdriver does anyone know what could be wrong with my setup

How to pass login form with captcha field using phantomjs?

血红的双手。 提交于 2019-12-07 17:25:18
问题 In one of my pages, I ask user for credentials of another website, so that I can log in the website with phantomjs in the background and get some data (because the website still doesn't have API or Oauth). I can log in most of the time, but sometimes the server got suspicious and the login form contains a captcha field. I can get the image and return it to the user for him to enter captcha code, but returning from the request, the phantomjs session is ended, and if I start another phantomjs

Determining if a TLS/SSL certificate is 'trusted' from the command line?

≯℡__Kan透↙ 提交于 2019-12-07 17:10:32
问题 I would like to be able to determine if a remote domain's TLS/SSL certificate is 'trusted' from the command line. Here is an openssl example I was playing with a few weeks back, here I use openssl to acquire the certificate and then pipe it to openssl's 'verify' command. I assumed that the 'verify' command would verify the certificate, however, how I understand it now is that the 'verify' command just verifies the certificate chain (I think). (cdn.pubnub.com is just a domain I found from a

How do I load Google Charts in node.js?

一笑奈何 提交于 2019-12-07 17:05:47
问题 When I attempt to load a Google Chart in node.js, nothing happens. I tried loading the first example from the line chart docs in both zombie.js and jsdom, but the chart never loads in either case. The end goal is to retrieve the SVG data of the generated chart for export into an image or PDF. So if an alternate method (server side using node.js or PHP) to achieve this is possible, I'm open to suggestions. NOTE : I have successfully generated a images of a few charts using gChartPhp, but the

Phantom-node module unable to load external resources

ⅰ亾dé卋堺 提交于 2019-12-07 15:29:05
问题 i'm working on a nodejs server which renders posted html to pdf,png or jpg. ( https://github.com/svenhornberg/pagetox (server.js) if you want to try it) It is working really good, renders complex sites but only to that point that i want do load a simple image. For example i am sending following code to my server: <!doctype html> <html> <head> <title>logo</title> </head> <body> <img alt="logo" src="http://upload.wikimedia.org/wikipedia/commons/d/de/Wikipedia_Logo_1.0.png"> </body> </html> The

Scrapping of the Twitter follower page using selenium and phantomjs

≡放荡痞女 提交于 2019-12-07 15:27:39
问题 I am trying to get the follower list of a given Twitter account. To do so, I manage to connect to my account using Selenium and PhantomJS (v2.1.1). Then, since Twitter is using infinite scrolling, I would like to implement the following algorithm: 1/ Count the number of html elements with class attribute equals ProfileCard-screennameLink 2/ Repeat: -Scroll down -Count the number of html elements with class attribute equals ProfileCard-screennameLink Until the number of elements does not

How to disable JavaScript in PhantomJS through Selenium WebDriver

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 14:38:56
问题 I want to disable JavaScript while scraping using scrapy and selenium. Moto of doing that is to increase scraping speed. I found the preference for Firefox driver but not PhantomJS. firefox_profile = webdriver.FirefoxProfile() firefox_profile.set_preference("javascript.enabled", False) driver = webdriver.Firefox(firefox_profile=firefox_profile) driver.get('http://www.quora.com/') How can this be done for PhantomJS webdriver? 回答1: The WebDriver protocol in PhantomJS is a pure JavaScript

how to wait for an iframe to load in selenium python with phantomjs

偶尔善良 提交于 2019-12-07 12:30:00
问题 Script for page to get is from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.desired_capabilities import DesiredCapabilities from selenium.webdriver.support import expected_conditions as EC import unittest import time, re, castro class LoginTest(unittest.TestCase): def setUp(self): self.driver = webdriver.PhantomJS() self.driver.maximize_window() self.driver.get("xxx.html") # getting the page "wanna wait her" print self.driver

How to set timeout for PhantomJS?

萝らか妹 提交于 2019-12-07 09:35:25
问题 Here's the code I have for setting it: from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities dcap = dict(DesiredCapabilities.PHANTOMJS) dcap["phantomjs.page.settings.resourceTimeout"] = ("5000") driver = webdriver.PhantomJS(desired_capabilities=dcap) However in my super long script, it doesn't seem to timeout when my internet is slow and a page takes longer than 5 seconds to load. There is so little documentation on PhantomJS time outs,