phantomjs

PhantomJSDriver works for HTTP but not for HTTPS

人盡茶涼 提交于 2019-12-31 04:52:08
问题 public class FooTest { WebDriver driver; @Before public void beforeTest() { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setJavascriptEnabled(true); capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true); driver = new PhantomJSDriver(capabilities); driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS); } @Test public void test() { driver.get("http://www.example.com"); WebElement e = driver.findElement(By.tagName("h1")); System.out.println(

Can't figure out why I can't retrieve a simple string with Xpath

隐身守侯 提交于 2019-12-31 04:25:08
问题 I can't figure out why I can't retrieve a simple string with XPath with this very simple snippet var page = new WebPage(); page.open('http://free.fr', function (status) { if (status !== 'success') { console.log('Unable to access network'); } else { function getElementByXpath(path) { return document.evaluate(path, document, null, XPathResult.STRING_TYPE, null).stringValue; } console.log( getElementByXpath("//title/text()") ); } phantom.exit(); } always return nothing. What I missed to print

Explain karma unit test times

血红的双手。 提交于 2019-12-31 02:36:28
问题 I've been searching the web for this for two days and I found nothing. Maybe I'm looking in the wrong way — I don't know... So here it is: what are the times on my console when running a Karma+Jasmine+phantomJs unit test? ... Executed 1 of 1 SUCCESS (0.878 secs / 0.112 secs) First, I though that the second time is the total unit test time (for example, when running multiple tasks), however, sometimes the first time gets to be 'bigger', sometimes not... Anyone? 回答1: total time / net time net

Selenium.PhantomJS is invalid namespace

独自空忆成欢 提交于 2019-12-31 00:41:08
问题 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;

PhantomJS does not work with Karma in Angular2 project

时间秒杀一切 提交于 2019-12-30 18:28:15
问题 I have created an out-of-the box project with the angular cli (1.0.0-rc1.0.0). Then I installed the PhantomJS plugin ( npm install karma-phantonjs-launcher ). Reproduction steps: create project with angular2 cli ( ng new TestPhantomJS ) run npm install karma-phantonjs-launcher in the karma.conf file add PhantomJS, ie change to browsers: ['Chrome'] this browsers:['Chrome', 'PhantomJS'] Reason beeing that for Team City integration I need a headless browser. The test run OK with ng test as long

How to see stdout of a phantomjs child process using node.js?

故事扮演 提交于 2019-12-30 07:10:31
问题 In the following node.js code, I normally have to wait for the phantomjs child process to terminate to get the stdout. I am wondering if there is any way to see the stdout while the phantomjs child process is running? var path = require('path') var childProcess = require('child_process') var phantomjs = require('phantomjs') var binPath = phantomjs.path var childArgs = [ path.join(__dirname, 'phantomjs-script.js'), ] childProcess.execFile(binPath, childArgs, function(err, stdout, stderr) { //

PhantomJS open one page after another

我与影子孤独终老i 提交于 2019-12-30 06:07:06
问题 I used this example to create a phantomjs code to login to website. var page = require('webpage').create(); page.open("http://www.facebook.com/login.php", function(status) { if (status === "success") { page.onConsoleMessage = function(msg, lineNum, sourceId) { console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")'); }; page.evaluate(function() { console.log('hello'); document.getElementById("email").value = "email"; document.getElementById("pass").value =

PhantomJS open one page after another

旧巷老猫 提交于 2019-12-30 06:06:26
问题 I used this example to create a phantomjs code to login to website. var page = require('webpage').create(); page.open("http://www.facebook.com/login.php", function(status) { if (status === "success") { page.onConsoleMessage = function(msg, lineNum, sourceId) { console.log('CONSOLE: ' + msg + ' (from line #' + lineNum + ' in "' + sourceId + '")'); }; page.evaluate(function() { console.log('hello'); document.getElementById("email").value = "email"; document.getElementById("pass").value =

CasperJS and 'Unsafe JavaScript attempt to access frame with URL' error

你离开我真会死。 提交于 2019-12-30 05:45:11
问题 I have simple page with javascript which validates email written in input: email.html: <!DOCTYPE html> <html> <head> <title>Email validation</title> <script src="email.js"></script> </head> <body> <span style="padding: 5px;"> <input type="text" id="email-input" placeholder="Email..."></input> </span> </body> </html> email.js: var checkEmail = function() { var regexp = /BIG_REGEX/; var email = document.getElementById('email-input').value; if (email === '') removeFrame(); else if (regexp.test