Testing React Apps with Phantom/Casper

烂漫一生 提交于 2019-12-08 19:42:35

You need to add the babel-polyfill NPM package to your project (or any other version of the polyfill) and then in your main index.js(x) entry point for your app, include this line at the top:

import 'babel-polyfill';

We were having the exact same issue you are experiencing and this fixed it for us.
We had tried injecting the babel polyfill as part of the Casper test suite, but it was not working.

Not sure how you did the waiting. Make sure your capture is in the wait callback. I usually use code like this and it often happens that you need to adjust the waiting time to see results.

3 seconds is usually enough to crawl public websites, that's how I use it.

casper.then(function() {
    this.wait(3000, function() {
        this.capture('foo.jpg', undefined, 
            {
                format: 'jpg',
                quality: 75
            });
    });
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!