phantomjs

Is there a way to view PhantomJS console.log messages via Selenium/GhostDriver?

跟風遠走 提交于 2019-12-21 03:48:27
问题 I'm using the Java bindings of GhostDriver to run Selenium acceptance tests against PhantomJS. If one of the web pages requested by PhantomJS logs to the Javascript console via console.log, is there a way to capture or view those messages? I'm guessing that the answer to this is forehead-slappingly simple but I can't work it out! 回答1: LogEntries logs = driver.manage().logs().get("browser"); 来源: https://stackoverflow.com/questions/19225532/is-there-a-way-to-view-phantomjs-console-log-messages

PyCharm unable to connect to GhostDriver

允我心安 提交于 2019-12-21 03:15:20
问题 I have a unit test that is passing when I run it via python manage.py test , but failing when I run it from within PyCharm. def test_alpha(self): from selenium.webdriver.common.utils import free_port from selenium import webdriver driver = webdriver.PhantomJS(executable_path=PHANTOMJS_PATH, port=free_port()) driver.quit() The exception I get when running from PyCharm is WebDriverException: Message: 'Can not connect to GhostDriver' I've spent a fair amount of time digging into this problem,

Cannot install phantomJS in Karma

女生的网名这么多〃 提交于 2019-12-21 03:11:37
问题 WARN [config]: config.configure() is deprecated, please use config.set() instead. WARN [plugin]: Cannot find plugin "karma-phantomjs". Did you forget to install it ? npm install karma-phantomjs --save-dev INFO [karma]: Karma v0.10.2 server started at http://localhost:9018/ WARN [launcher]: Can not load "PhantomJS", it is not registered! Perhaps you are missing some plugin? Getting this error. When running npm install karma-phantomjs --save-dev I get an error. npm ERR! 404 'karma-phantomjs' is

How to run QUnit test and get back test result in C# via JavaScript callback?

余生颓废 提交于 2019-12-21 02:38:20
问题 In my several projects, I use MVC pattern for separating code (of concerns) into 3 tiers. Both of Model and Control tiers run on C# so I use testing framework like MSTest or NUnit to validate functional requirement for these tiers. For View tiers, I use QUnit to test JavaScript files. However, I cannot execute QUnit as automated test because MSTest doesn't directly support for testing web page. I need to run it in MSTest like the following logic. [TestMethod] public void JavaScriptTest() {

PhantomJS and clicking a form button

好久不见. 提交于 2019-12-21 01:58:05
问题 I have a very simple HTML form that I'm attempting to test with various kinds of data. I wrote a prototype proof-of-concept in MS Access/VBA using the IE object. It worked fine but the finished testing product has to use PhantomJS. I've got the page-interfacing to work and the form is populating just fine. Where I'm stuck is getting the submit button to fire. I've combed through S.O. and tried all suggestions and nothing is working. I'm using PhantomJS 1.9.7 and using straight JavaScript test

Integrate chrome extensions with phantomjs

♀尐吖头ヾ 提交于 2019-12-20 18:43:10
问题 Is there a way we can install chrome extensions (.crx) with phantomjs? My task here is to integrate adblockplus with phantomjs so that I can filter all the ad-urls and report using phantomjs. Or any other way to integrate the adblockplus extension with phantomjs? 回答1: PhantomJS is based on a three-year old WebKit fork (QtWebKit), not Chromium. Therefore you cannot load Chrome extensions in PhantomJS. If you want to use Chrome extensions in an automated way, I suggest to use the ChromeDriver

Poltergeist throws JS errors when js_errors: false

被刻印的时光 ゝ 提交于 2019-12-20 18:07:27
问题 I have a large test suite that is using poltergeist and capybara. I keep getting the following error: One or more errors were raised in the Javascript code on the page. If you don't care about these errors, you can ignore them by setting js_errors: false in your Poltergeist configuration (see documentation for details). I am pretty sure I have set js_errors: false but I am still getting the errors. I realize that the optimal solution is to fix the JS but I am inheriting legacy code and fixing

Phantomjs does not execute function in page.evaluate function

你离开我真会死。 提交于 2019-12-20 18:06:30
问题 I'm scraping a Facebook page with the PhantomJS node module (https://github.com/sgentle/phantomjs-node), but when I try evaluating the page, it does not evaluate the function I pass to it. Executing it in a standalone script and running it with the Node interpreter works.. The same code in an Express.js app does not work. This is my code facebookScraper.prototype.scrapeFeed = function (url, cb) { f = ':scrapeFeed:'; var evaluator = function (s) { var posts = []; for (var i = 0; i < FEED_ITEMS

CasperJS: Configure proxy options inside code

拈花ヽ惹草 提交于 2019-12-20 15:33:49
问题 I was wondering how we could set cli parameters inside our code and not by placing them at the end of our command like this: casperjs casper_tor.js --proxy=127.0.0.1:9050 --proxy-type=socks5 I've tested things like that but it didn't work: var casper=require('casper').create(); casper.cli.options["proxy"] = "127.0.0.1:9050"; casper.cli.options["proxy-type"] = "socks5"; ... casper.run(); What I'm trying to achieve is to set new proxies inside my code and to scrap my new ip address from

selenium.common.exceptions.WebDriverException: Message: 'Can not connect to GhostDriver'

匆匆过客 提交于 2019-12-20 10:29:19
问题 I'm trying to run PhantomJS from within selenium.webdriver on a Centos server. PhantomJS is in the path and is running properly from terminal. However in the script it appears to be launched, but afterwards cannot be reached on the specified port (I tried 2 different opened ports from my provider 29842 and 60099, they both are not working and neither launching it without a specified port). The error happens here in selenium.webdriver.common.utils : try: socket_ = socket.socket(socket.AF_INET,