Search Posts

Category: phantomjs

CasperJS Angular Button not working

I am trying to click through this website’s login section using Casper. The website uses Angular to validate form responses. When I fill in the “Enter Username” input and click “Login” button, the screenshot that I get shows the “Login” button transform to “Checking” text and remains like that. Here is my code: casper.then(function() { //enter the username this.evaluate(fillUserName,username); console.log(“username entered”) this.then(function() { //without this wait function, no click action occurs this.wait(2000, function() { console.log(“clicking […]

Angular js 1.6.9 tests Unknown provider: $$taskTrackerFactoryProvider

My project is forced to be in 1.6.9 due to regression risks (for example, lowercase is obsolete in 1.7). But recently, I made a npm update and all my karma/phantomjs tests are failing, giving PhantomJS 2.1.1 (Windows 7.0.0) Error: [$injector:unpr] Unknown provider: $$taskTrackerFactoryProvider <- $$taskTrackerFactory <- $browser <- $rootScope <- $browser http://errors.angularjs.org/1.6.9$injector/unpr?p0=%24%24taskTrackerFactoryProvider%20%3C-%20%24%24taskTrackerFactory%20%3C-%20%24browser%20%3C-%20%24rootScope%20%3C-%20%24browser in C:/Users/XXX/AppData/Local/Temp/b99f75028e9c85bb8c30a356a1480903.browserify (line 8627) c:/Users/XXX/AppData/Local/angular/angular.js:4887:0 <- C:/Users/XXX/AppData/Local/Temp/b99f75028e9c85bb8c30a356a1480903.browserify:8627:86 [email protected]:/Users/XXX/AppData/Local/angular/angular.js:5047:0 <- C:/Users/XXX/AppData/Local/Temp/b99f75028e9c85bb8c30a356a1480903.browserify:8787:39 c:/Users/XXX/AppData/Local/angular/angular.js:4892:0 <- C:/Users/XXX/AppData/Local/Temp/b99f75028e9c85bb8c30a356a1480903.browserify:8632:48 [email protected]:/Users/XXX/AppData/Local/angular/angular.js:5047:0 <- C:/Users/XXX/AppData/Local/Temp/b99f75028e9c85bb8c30a356a1480903.browserify:8787:39 [email protected]:/Users/XXX/AppData/Local/angular/angular.js:5072:0 <- C:/Users/XXX/AppData/Local/Temp/b99f75028e9c85bb8c30a356a1480903.browserify:8812:68 [email protected]:/Users/XXX/AppData/Local/angular/angular.js:5098:0 <- C:/Users/XXX/AppData/Local/Temp/b99f75028e9c85bb8c30a356a1480903.browserify:8838:31 c:/Users/XXX/AppData/Local/angular/angular.js:4893:0 […]

Drupal Website Scraping

What is the best option in Scraping the content of the website? The website is in Drupal7 and PHP 5.5.9. I want to scrape after web page fully loaded. I know there are some options like PhantomJS and others but I’m unable to get content after full page load with PhantomJS. My script for PhantomJS is this: var page = new WebPage() page.onLoadFinished = function() { console.log(page.content); phantom.exit(); }; page.open(“https://www.mywebsite.com/”, function() { }); Any other […]

Karma-Jasmine async test returns Error: Timeout – Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL [duplicate]

This question already has an answer here: Unit testing an asynchronous service in angularjs 2 answers I am currently writting tests for one of my AngularJS services in which I have async methods. In my Jasmine test the method is correctly called but I can’t retrieve the promise and I get the following error message : Error: Timeout – Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL. I’ve tested to change the timeout […]

Do detect as compelleted before runing an XHR in a controller Angularjs

I have an application which is using Angularjs. In each controller, I have a function that should run on route loading. I mean I want a constructor function in my controller. I want that the browser does not mark the page az completed page (ready document) before finishing that XHR request. The reason is I`m using a system to render HTML snapshot of my pages, and I want to tell Phantomejs that the page is […]

AngularJS, Node.js, node module ‘phantom’… Injection error, angularjs trying to load my directive + Suffix

When I load an AngularJS page it loads fine. No console errors. Content shows as expected. When I load the same page from another app, using Node module ‘phantom’ it fails with error: Error: [$injector:unpr] http://errors.angularjs.org/1.5.8/$injector/unpr?p0=WidgetsProvider%20%3C-%20Widgets%20%3C-%20dashboardWeightTableWidgetDirective From the angular site this link equates to: Unknown provider: WidgetsProvider <- Widgets <- dashboardWeightTableWidgetDirective Please notice the directive name. “dashboardWeightTableWidgetDirective“. The directive is named, and referred to everywhere in my code as: “dashboardWeightTableWidget“. What is happening is that […]

Google cache redirects AngularJS site rendered by PhantomJS

Google cache strangely redirects my site (301 redirect) to www.google.com if I try any of the cached content, for example: http://webcache.googleusercontent.com/search?q=dietomat.pl http://webcache.googleusercontent.com/search?q=cache:dietomat.pl/strona/kontakt http://webcache.googleusercontent.com/search?q=cache:dietomat.pl/artykuly This is AngularJS 1.x site rendered by means of PhantomJS especially for googlebot. If I render these pages in Search Console they look fine. Also when I set User Agent to gBot in any browser it also looks good (no redirects take place). This behavior seems bad to SEO since the same […]

Null is not an object (evaluating ‘a.isConnected’) using Angular TestBed against Phantom

I’m using PhantomJS 2.1.1 and I have the following TestBed setup: TestBed.configureTestingModule({ declarations: [ MyComponent ], imports: [ InputModule, PanelModule, ReactiveFormsModule, RouterTestingModule, OtherComponentModule ], providers: [ { provide: ActivatedRoute, useValue: activatedRoute } ] }) .overrideModule(SidebarModule, { add: { imports: [ StoreModule.provideStore(reducer) ] } }) .compileComponents(); fixture = TestBed.createComponent(MyComponent); component = fixture.componentInstance; fixture.detectChanges(); When the component is been created I get the following issue: Failed: null is not an object (evaluating ‘a.isConnected’) J appendChild insertRootElement createComponent […]

Why won’t "ng test" find my unit tests within npm packages?

I recently upgraded my team’s enterprise application to @angular/cli 1.4.5, and since then have not been able to run unit tests on the code within our private npm packages. Prior to the upgrade I had no problems running my unit tests, but ng test now only picks up unit tests located within src/app. Included are the src/test.ts file and karma.conf.js file, as well as the console output when trying to run the contexts from the […]

How to use phantomjs to click "Load More" button continually until page is fully populated?

I’m very new at learning phantomjs and casperjs and looking for some pointers in how to click a “Load More” button to fully populate a page. I’ve looked through similar questions but don’t see anything that matches (at least not that I understand). The idea is to scrape viewer counts off a livestream.com event page. To start, I can grab the first page in plain text with phantomjs (using cnet as an example) as follows: […]

Next Page »