phantomjs

Debugging jasmine tests with resharper and phantom js

橙三吉。 提交于 2019-11-30 18:50:49
Similar question was already asked some time ago How do you debug Jasmine tests with Resharper? What is suggested there doesn't really work for me (place debugger; in test code). Each time the tests are run, a new browser window opens and thread jumps through debugger. Is there any way to make it work? And also is there any way to debug jasmine tests with phantom runner and Resharper? Thanks in advance To debug in the browser, add the code below to your js test file. jasmine.getEnv().currentRunner_.finishCallback = function () {}; Resharper won't be notified that the test has finished so we

Scraping webpage with react JS in R

别来无恙 提交于 2019-11-30 18:34:04
问题 I'm trying to scrape page below : https://metro.zakaz.ua/uk/?promotion=1 This page with react content. I can scrape first page with code: url="https://metro.zakaz.ua/uk/?promotion=1" read_html(url)%>% html_nodes("script")%>% .[[8]] %>% html_text()%>% fromJSON()%>% .$catalog%>%.$items%>% data.frame In result I have all items from first page, but I don't know how to scrape others pages. This js code move to other page if that can help: document.querySelectorAll('.catalog-pagination')[0]

PhantomJS click a link on a page

﹥>﹥吖頭↗ 提交于 2019-11-30 18:33:28
I have written some parts of a PhantomJS application. I am parsing on a website where I am writing username and password to a formular. After this I have to click on a link. Whereas I get this error: TypeError: 'undefined' is not a function (evaluating 'myLink.click()') phantomjs://webpage.evaluate():11 phantomjs://webpage.evaluate():22 phantomjs://webpage.evaluate():22 This is my PhantomJS code: if(document.getElementById("m_Content_submitbtn2").getAttribute('data-role') == "button"){ var myLink = document.getElementById("m_Content_submitbtn2"); myLink.click(); } And this is my link: <div

Unit Testing/mocking Window properties in Angular2 (TypeScript)

穿精又带淫゛_ 提交于 2019-11-30 17:34:47
I'm building some unit tests for a service in Angular2. Within my Service I have the following code: var hash: string; hash = this.window.location.hash; However when I run a test which contains this code, it will fail. It'd be great to utilise all the features of Window, but as I'm using PhantomJs, I don't think this is possible (I have also tried Chrome which yields the same results). In AngularJs, I would have resorted to mocking $Window (or at least the properties in question), but as there is not a lot of documentation for Angular2 unit testing I'm not sure how to do this. Can anyone help?

How to install PhantomJS v2 with npm

时间秒杀一切 提交于 2019-11-30 16:53:22
I'm trying to install PhantomJS v2.0.0 using npm and after trying a couple of methods I've not found a working solution... On NPM the latest version is 1.9.16 , so I've tried the following in my package.json : "phantomjs": "https://github.com/ariya/phantomjs/archive/2.0.0.tar.gz" This gives me an error because there isn't a package.json for this version in the github repo. "phantomjs": "2.0.0" This tells me there is no version with this number available. Am I missing something here? Artjom B. phantomjs-prebuilt was renamed from phantomjs and now additionally contains binaries for version 2.1+.

Could not find phantomjs

百般思念 提交于 2019-11-30 16:53:03
Getting the following error when trying to use phantomjs from ruby on Ubuntu: Failure/Error: visit root_path Cliver::Dependency::NotFound: Could not find an executable ["phantomjs"] on your path. # ./spec/features/search_spec.rb:17:in `block (2 levels) in <top (required)>' # ./spec/support/vcr.rb:23:in `block (3 levels) in <top (required)>' # ./spec/support/vcr.rb:23:in `block (2 levels) in <top (required)>' phantomjs was built locally and added to PATH. How do I make ruby find phantomjs? Instead of building locally, use homebrew on your mac with brew install phantomjs and all the paths will

How do I run casper from within the phantomjs shell?

假如想象 提交于 2019-11-30 16:31:42
Anyone know if and how it's possible to run casperjs from within the phantomjs shell (a.k.a InteractiveModeREPL )? I've also tried passing the direct path to the casper.js module and that has not worked either. Progress/Update: Tried phantomjs.injectJs('C:/casperjs/module/casper.js'); but got Error: Cannot find module 'colorizer' I guess I'm getting close. This gets me closer but still missing path: phantomjs.injectJs('C:/casperjs/module/bin/bootstrap.js') errors out with Cannot find package.json at C:/package.json OK, looks like I can pass the --casper-path option when starting phantomjs (see

Loop through list of clickable elements and write out the html to respective files

只谈情不闲聊 提交于 2019-11-30 16:06:05
问题 I'm using jQuery to get a list of elements that contain certain key words. I'm able to get the list of elements but I don't know how to loop through each element, click on its child element and download the newly loaded page. Here's the casperjs code I have so far: var casper = require('casper').create({ clientScripts: ["/var/www/html/project/public/js/jquery-3.3.1.min.js"] }); var fs = require('fs'); casper.start('https://m.1xbet.co.ke/en/line/Football/', function () { var links = casper

Pass parameter from php to casperjs/phantomjs

孤者浪人 提交于 2019-11-30 16:04:50
问题 Edit: I answered my own question, see edit below. ORIGINAL: I have phantomjs and casperjs installed on my web server and they both run fine. The script I am planning on creating relise on a user input from my website, which is then passed on to the casperjs script. After fiddling around a bit, I noticed that I am stuck on the very basic task of the user input. How would pass the variable from php to casperjs? Please note, the following are just test scripts. My php script $user_input = $_POST

Using a headless browser with Heroku Rails Unicorn stack

我们两清 提交于 2019-11-30 15:53:40
I have seen posts that you can change the build on Heroku, to use PhantomJS with the Cedar stack, but is it possible to run a headless browser on the unicorn stack? Yes, and someone already wrote a buildpack for including PhantomJS (the internet and open source are amazing). If you want to run headless PhantomJS on a Heroku dyno, you will need to: Switch to Heroku multi-buildpack: https://github.com/ddollar/heroku-buildpack-multi Setup Ruby buildpack for your app: https://github.com/heroku/heroku-buildpack-ruby Setup PhantomJS buildpack for your needs: https://github.com/stomita/heroku