selenium standalone以未知错误终止

时间:2015-10-30 04:00:49

标签: protractor

当我开始测试时,浏览器打开并在几秒钟后显示ip,ip被更改为“data;”在终端中,测试已循环并发送错误ms

empresss-Mac-mini:myApp admin $ protractor test / e2e.js     在http://localhost:4444/wd/hub使用selenium服务器     [launcher]运行WebDriver的1个实例     入门     茉莉花规格超时了。重置WebDriver控制流。     ˚F

Failures:
1) header Module should check title text
  Message:
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
  Stack:
    Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
  Message:
    Failed: header is not defined
  Stack:
    ReferenceError: header is not defined
        at Object.<anonymous> (/Users/admin/myApp/www/head.spec.js:8:13)
    From: Task: Run it("should check title text") in control flow
    From asynchronous test: 
    Error
        at Suite.<anonymous> (/Users/admin/myApp/www/head.spec.js:7:4)
        at Object.<anonymous> (/Users/admin/myApp/www/head.spec.js:1:63)

1 spec, 1 failure
Finished in 30.019 seconds
[launcher] 0 instance(s) of WebDriver still running
[launcher] chrome #1 failed 1 test(s)
[launcher] overall: 1 failed spec(s)
[launcher] Process exited with error code 1

我的配置文件是

exports.config = {
  framework: 'jasmine2',
  seleniumAddress: 'http://localhost:4444/wd/hub',
  specs: ['../www/head.spec.js'],
  multiCapabilities: [
  {
    browserName: 'chrome'
  }],
  onPrepare: function(){
        browser.driver.get('http://192.168.1.2:8100');
    }
}
我把它命名为e2e.js 我的测试文件是

describe('header Module', function(){

   beforeEach(function() {
        var header = element(by.css('title'));
    });

   it('should check title text',function(){
        expect(header.getText()).toContain('Ionic Blank Starter');    
    });
});

我下载了一个空白离子应用程序,我想测试标题包含元素“Ionic Blank Starter”

1 个答案:

答案 0 :(得分:0)

您没有在项目中很好地处理异步代码。 std::size_t size() const; // until C++11 constexpr std::size_t size(); // since C++11, until C++14 constexpr std::size_t size() const; // since C++14) 返回在断言文本之前需要解决的promise。你可以这样做:

header.getText()