Search Posts

Category: phantomjs

Google cache redirects AngularJS site rendered by PhantomJS

Google cache strangely redirects my site (301 redirect) to if I try any of the cached content, for example: 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 event page. To start, I can grab the first page in plain text with phantomjs (using cnet as an example) as follows: […]

PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR ReferenceError: Can’t find variable: Map

I have used “MVC ASP.NET Core with Angular” template. I am trying to include phantomJS and run the tests, but i get the following errors: ERROR in [at-loader] ..node_moduleszone.jsdistzone.js.d.ts:122:11 TS2451: Cannot redeclare block-scoped variable ‘Zone’. ERROR in [at-loader] ..node_moduleszone.js distzone.js.d.ts:363:14 TS2300: Duplicate identifier ‘HasTaskState’. ERROR in [at-loader] ..node_moduleszone.js distzone.js.d.ts:372:14 TS2300: Duplicate identifier ‘TaskType’. ERROR in [at-loader] ..node_moduleszone.js distzone.js.d.ts:458:15 TS2451: Cannot redeclare block-scoped variable ‘Zone’. PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR ReferenceError: Can’t find variable: Map […]