我正在使用量角器来测试Angular代码。当我通过chrome驱动运行它时,测试运行正常,默认情况下使用webdriver-manager。现在我想用phantomjs(无头浏览器)运行相同的测试,因为我需要通过服务器运行此测试。但通过phantomjs运行测试,而我得到的错误:无法使用phantomjs运行量角器测试
Failed: Angular could not be found on the page URL : retries looking for angular exceeded
的conf文件是:
exports.config = {
framework: 'jasmine',
seleniumAddress: 'http://localhost:4444/wd/hub',
specs: ['demo-test.js'],
capabilities: {
browserName: 'phantomjs',
version: '',
platform: 'ANY'
};
演示test.js文件看起来像:
// demo-test.js
describe('Protractor Demo App', function() {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000000;
beforeEach(function() {
browser.driver.manage().window().setSize(1280, 1024);
});
it('should have a title', function() {
browser.get('URL');
expect(browser.getTitle()).toEqual('Title');
});
请帮助我。我以官方site和安装phantomjs指令通过
sudo apt-get install phantomjs
我不会用量角器推荐phantomJS。请尝试在您的服务器上使用带有铬的XVFB,以虚拟显示器运行浏览器。 – martin770
嘿@ martin770感谢您的建议,你能提供任何文件链接,我可以找到如何做到这一点? –