phantomjs

selenium PhantomJS send_keys doesn't work

匿名 (未验证) 提交于 2019-12-03 03:10:03
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using selenium and PhantomJS for testing. I followed Selenium's simple usage, but send_keys doesn't work on PhantomJS, it works on Firefox. Why? I have to use button.click() instead? #!/usr/bin/python # -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8') from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.PhantomJS() driver.get("http://www.python.org/") elem = driver.find_element_by_id("q") elem.clear() elem.send_keys("python") elem.send_keys(Keys.RETURN) # button =

How to install PhantomJS for use with Python Selenium on the Raspberry Pi?

匿名 (未验证) 提交于 2019-12-03 02:58:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to run a Python script using Selenium WebDriver with PhantomJS as a headless browser on my Raspberry Pi running Raspbian. I originally wrote the script in OS X where it works fine. But in trying to make it work on the Raspberry, I'm having problems. When trying to run the script, I get this error: raise WebDriverException("Can not connect to the Service %s" % self.path) selenium.common.exceptions.WebDriverException: Message: Can not connect to the Service /usr/bin/phantomjs Brief version of the script: from selenium import webdriver

PhantomJS and iFrame

倖福魔咒の 提交于 2019-12-03 02:57:26
I'm using phantomjs(1.5) and casperjs for my functional tests. casper = require('casper').create loadImages: false casper.start 'http://vk.com', -> @fill 'form[name="login"]', { email: mail, pass: pass}, true casper.thenOpen "http://vk.com/#{app}", -> @echo "User at #{app}" casper.then -> @click "iframe['element']" #?! how I can do it? casper.then -> @wait 2000000, -> @echo "exit from room: #{num}" casper.run() So, I login to vk.com (social network in Russia), my app loaded with iframe. How I can use elements in iFrame, for example click to a button? Pedro Vargas The recent versions of

PhantomJS not captured when ran via build server

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Karma and PhantomJS with Jasmine to test my AngularJS. When I run my gulp test locally it works fine, launches PhantomJS and runs all my tests, but when the tests get run on the build server it fails with the following errors: Note that I am using VSTS and using their built in cloud build system (hosted agent). Having said that its pretty much a task runner and I only use it to run gulp tasks (build, test etc) on checkin [32m13 07 2016 15:21:32.260:INFO [karma]: [39mKarma v1.1.1 server started at http://localhost:9876/ [32m13 07

phantomjs pdf to stdout

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am desperately trying to output a PDF generated by phantomJS to stdout like here What I am getting is an empty PDF file, although it is not 0 in size, it displays a blank page. var page = require('webpage').create(), system = require('system'), address; address = system.args[1]; page.paperSize = {format: 'A4'}; page.open(address, function (status) { if (status !== 'success') { console.log('Unable to load the address!'); phantom.exit(); } else { window.setTimeout(function () { page.render('/dev/stdout', { format: 'pdf' }); phantom.exit(); }

PhantomJS hangs for a long time saying “Asynchronous Sessions clean-up phase starting NOW”

匿名 (未验证) 提交于 2019-12-03 02:50:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Here is a screenshot: task : Codeception PHP Testing Framework v1.6.2 Powered by PHPUnit 3.7.19 by Sebastian Bergmann. Suite selenium_acceptance started Trying to see the welcome page of newweather (welcomeCept.php) issue : it sits as it is and waiting for phantomJS to respond and below is what phantomJS screen is showing : [INFO - 2014-03-13T01:42:51.575Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: ca14e740-aa50-11e3-bb6b-75468ba86108 [INFO - 2014-03-13T01:47:42.806Z] SessionManagerReqHand -

PhantomJS using too many threads

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I wrote a PhantomJS app to crawl over a site I built and check for a JavaScript file to be included. The JavaScript is similar to Google where some inline code loads in another JS file. The app looks for that other JS file which is why I used Phantom. What's the expected result? The console output should read through a ton of URLs and then tell if the script is loaded or not. What's really happening? The console output will read as expected for about 50 requests and then just start spitting out this error: 2013-02-21T10:01:23 [FATAL]

Karma, PhantomJS and es6 Promises

匿名 (未验证) 提交于 2019-12-03 02:49:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am writing a JavaScript library that uses the new es6 promises. I can test the library in Firefox because promises are defined. However, when I try to test my code with Karma and PhantomJS, I get the error Can't find variable: Promise. . I am guessing this is because the PhantomJS browser doesn't support es6 promises yet. How can I configure Karma to bring in the polyfill for promises? 回答1: You can pull in the Babel polyfill by simply installing Babel Polyfill : npm install --save-dev babel-polyfill and then include the polyfill file

Python: Selenium with PhantomJS empty page source

匿名 (未验证) 提交于 2019-12-03 02:48:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm having trouble with Selenium and PhantomJS on Windows7 when I want to get the source of the page of an URL. browser.page_source returns only . I've put a sleep before browser.page_source but it didn't help. This is my code: from selenium import webdriver browser = webdriver.PhantomJS('phantomjs-1.9.7-windows\phantomjs.exe') url = 'myurl' browser.get(url) print browser.page_source On Linux with the same version of PhantomJS it works perfectly. Also it works on Windows Server 2003. 回答1: by default phantomjs use SSLv3, but many sites after

CasperJS : Why does my url change to about:blank when my page is loaded?

☆樱花仙子☆ 提交于 2019-12-03 02:44:43
I'm a beginner at PhantomJS/CasperJS. I just want to start a session and verify that it's OK. Here's my code: var casper = require('casper').create({ verbose: true, logLevel: 'debug', pageSettings: { loadImages: false, loadPlugins: false, userAgent: 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36 Edge/12.0' } }); casper.on('remote.message', function(msg) { this.echo('remote message caught: ' + msg); }); casper.on("page.error", function(msg,trace) { this.echo("Page Error: " + msg, "ERROR"); }); casper.start('https://www.google.fr');