Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs 测试在firefox上运行时会挂起,但同样的测试在chrome上完全可以运行 节点版本:5.10.1 量角器版本:3.2.2 浏览器:firefoxv。45.0.2 操作系统Windows 8.1 x64 web应用程序“1.5.0”上的Angular Selenium服务器“Selenium-server-standalone-2.53.0”_Angularjs_Selenium_Firefox_Protractor - Fatal编程技术网

Angularjs 测试在firefox上运行时会挂起,但同样的测试在chrome上完全可以运行 节点版本:5.10.1 量角器版本:3.2.2 浏览器:firefoxv。45.0.2 操作系统Windows 8.1 x64 web应用程序“1.5.0”上的Angular Selenium服务器“Selenium-server-standalone-2.53.0”

Angularjs 测试在firefox上运行时会挂起,但同样的测试在chrome上完全可以运行 节点版本:5.10.1 量角器版本:3.2.2 浏览器:firefoxv。45.0.2 操作系统Windows 8.1 x64 web应用程序“1.5.0”上的Angular Selenium服务器“Selenium-server-standalone-2.53.0”,angularjs,selenium,firefox,protractor,Angularjs,Selenium,Firefox,Protractor,我是量角器新手,英语不好。 情况: 我有一个测试(实际上是一套测试),它通过了对chrome的测试,但在对firefox的测试中几乎立即挂起,它在点击链接后挂起,在应该完成后挂起 测试示例: var homePageAddress = 'http://localhost'; var someLink = element(by.css('.navigationpanel-element[translate="SomeText.SomeText"]')); var someTitle = elem

我是量角器新手,英语不好。 情况: 我有一个测试(实际上是一套测试),它通过了对chrome的测试,但在对firefox的测试中几乎立即挂起,它在点击链接后挂起,在应该完成后挂起

测试示例:

var homePageAddress = 'http://localhost';

var someLink = element(by.css('.navigationpanel-element[translate="SomeText.SomeText"]'));
var someTitle = element(by.css('.titlepanel-title-first[translate="omeText.SomeText"]'));
var someOtherLink = element(by.css('[translate="SomeText.SomeText"]'));
var someSearchBox = element(by.css('input.search-box'));
var listOfItems = element(by.css('li.list-item'));

browser.get(homePageAddress);

someLink.click();
//It hangs here in firefox
expect(someTitle.isDisplayed()).toEqual(true, 'Some result text');
expect(someOtherLink.isDisplayed()).toEqual(true, 'Some result text');
expect(someSearchBox.isDisplayed()).toEqual(true, 'Some result text');
expect(listOfItems.isPresent()).toEqual(true, 'Some result text');
conf.js:

exports.config = {
  directConnect: true,

    capabilities: {
        'browserName': 'firefox'
    },
    framework: 'jasmine2',

    specs: ['chromeOrganizationCreation.js'],

    jasmineNodeOpts: {
        defaultTimeoutInterval: 30000
    },  

   onPrepare: function() {  
        require('./waitReady.js');
   }
};
所以,正如我在chrome上所说的,它运行得很好,但在firefox上运行时,它会在第一次点击后挂起,甚至浏览器窗口也不会关闭

量角器日志显示:

A Jasmine spec timed out. Resetting the WebDriver Control Flow.
Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.
增加超时时间不会产生结果,但行为是相同的

一段selenium服务器日志(结束):

09:49:56.693调试[20]org.apache.http.wire-http-outing-11http://127.0.0.1:7055][保持活动状态的总数:0;分配的路由:2000年的0;分配的总数:2000年的0]
09:49:56.695调试[20]org.openqa.selenium.remote.RemoteWebDriver-已执行:[c9f64f66-fc8c-4f3d-a0be-535b63370dd0,单击元素{id={c0ac812d-747e-4bf9-9678-ae6025d656c1}]
09:49:56.695信息[14]org.openqa.selenium.remote.server.DriverServlet-完成:[单击:0[[FirefoxDriver:WINDOWS上的firefox(c9f64f66-fc8c-4f3d-a0be-535b63370dd0)]->css选择器:.navigationpanel元素[translate=“SomeText.SomeText”]]
09:49:56.700调试[14]org.openqa.selenium.remote.server.DriverServlet-完成:POST/session/e92fa9f1-8822-4f27-85a2-9f929d484e4a/element/0/单击
09:49:56.710调试[14]org.openqa.selenium.remote.server.DriverServlet-处理:POST/session/e92fa9f1-8822-4f27-85a2-9f929d484e4a/execute_async
09:49:56.712信息[14]org.openqa.selenium.remote.server.DriverServlet-执行:[执行异步脚本:尝试{return(函数(根选择器,回调){
var el=document.querySelector(rootSelector);
试一试{
if(window.getAngularTestability){
window.getAngularTestability(el).whenStable(回调);
返回;
}
如果(!window.angular){
抛出新错误('window.angular未定义。这可能是'+
'因为这是一个无角度的页面,或者因为您的测试涉及到'+
'客户端导航,可能干扰量角器的'+
'自举。参见http://git.io/v4gXM 有关详情);;
}
if(角度可获取性){
角度.可获取性(el).whenStable(回调);
}否则{
如果(!angular.element(el.injector()){
抛出新错误('根元素('+rootSelector+')没有注入器。'+
“这可能意味着它不在ng应用程序中。”);
}
angular.element(el.injector().get(“$browser”)。
notifyWhenNoOutstandingRequests(回调);
}
}捕捉(错误){
回调(错误消息);
}
}).应用(这个,参数);}
catch(e){throw(e instanceof Error)?e:newerror(e);}[body.ng scope]]
09:49:56.713调试[20]org.openqa.selenium.remote.RemoteWebDriver-执行:executeAsyncScript[c9f64f66-fc8c-4f3d-a0be-535b63370dd0,executeAsyncScript{script=try{return(函数(根选择器,回调){
var el=document.querySelector(rootSelector);
试一试{
if(window.getAngularTestability){
window.getAngularTestability(el).whenStable(回调);
返回;
}
如果(!window.angular){
抛出新错误('window.angular未定义。这可能是'+
'因为这是一个无角度的页面,或者因为您的测试涉及到'+
'客户端导航,可能干扰量角器的'+
'自举。参见http://git.io/v4gXM 有关详情);;
}
if(角度可获取性){
角度.可获取性(el).whenStable(回调);
}否则{
如果(!angular.element(el.injector()){
抛出新错误('根元素('+rootSelector+')没有注入器。'+
“这可能意味着它不在ng应用程序中。”);
}
angular.element(el.injector().get(“$browser”)。
notifyWhenNoOutstandingRequests(回调);
}
}捕捉(错误){
回调(错误消息);
}
}).应用(这个,参数);}
catch(e){throw(e instanceof Error)?e:newerror(e);},args=[body.ng scope]}]
09:49:56.714调试[20]org.apache.http.client.protocol.RequestAddCookies-CookieSpec selected:default
09:49:56.715调试[20]org.apache.http.client.protocol.RequestAuthCache-未在上下文中设置Auth缓存
09:49:56.715调试[20]org.apache.http.impl.conn.poolighttpclientconnectionmanager-连接请求:[路由:{}->http://127.0.0.1:7055][保持活动状态的总数:0;分配的路由:2000年的0;分配的总数:2000年的0]
09:49:56.715调试[20]org.apache.http.impl.conn.poolighttpclientconnectionmanager-租用连接:[id:12][route:{}->http://127.0.0.1:7055][保持活动状态的总数:0;分配的路线:2000年第1条;分配的总数:2000年第1条]
09:49:56.715调试[20]org.apache.http.impl.execchain.MainClientExec-打开连接{}->http://127.0.0.1:7055
09:49:56.716调试[20]org.apache.http.impl.conn.DefaultHttpClientConnectionOperator-连接到/127.0.0.1:7055
09:49:56.716调试[20]org.apache.http.impl.conn.DefaultHttpClientConnectionOperator-已建立连接127.0.0.1:58730127.0.0.1:7055
09:49:56.717调试[20]org.apache.http.impl.conn.DefaultManagedHttpClient连接-http-outgoing-12:将套接字超时设置为10800000
09:49:56.717调试[20]org.apache.http.impl.execchain.MainClientExec-执行请求POST/hub/session/c9f64f66-fc8c-4f3d-a0be-535b63370dd0/execute\a
    09:49:56.693 DEBUG [20] org.apache.http.wire - http-outgoing-11 << "{"name":"clickElement","sessionId":"c9f64f66-fc8c-4f3d-a0be-535b63370dd0","status":0,"value":"ok"}"
    09:49:56.693 DEBUG [20] org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-11: Close connection
    09:49:56.693 DEBUG [20] org.apache.http.impl.execchain.MainClientExec - Connection discarded
    09:49:56.694 DEBUG [20] org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection released: [id: 11][route: {}->http://127.0.0.1:7055][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
    09:49:56.695 DEBUG [20] org.openqa.selenium.remote.RemoteWebDriver - Executed: [c9f64f66-fc8c-4f3d-a0be-535b63370dd0, clickElement {id={c0ac812d-747e-4bf9-9678-ae6025d656c1}}]
    09:49:56.695 INFO [14] org.openqa.selenium.remote.server.DriverServlet - Done: [click: 0 [[FirefoxDriver: firefox on WINDOWS (c9f64f66-fc8c-4f3d-a0be-535b63370dd0)] -> css selector: .navigationpanel-element[translate="SomeText.SomeText"]]]
    09:49:56.700 DEBUG [14] org.openqa.selenium.remote.server.DriverServlet - Finished: POST /session/e92fa9f1-8822-4f27-85a2-9f929d484e4a/element/0/click
    09:49:56.710 DEBUG [14] org.openqa.selenium.remote.server.DriverServlet - Handling: POST /session/e92fa9f1-8822-4f27-85a2-9f929d484e4a/execute_async
    09:49:56.712 INFO [14] org.openqa.selenium.remote.server.DriverServlet - Executing: [execute async script: try { return (function (rootSelector, callback) {
      var el = document.querySelector(rootSelector);

      try {
        if (window.getAngularTestability) {
          window.getAngularTestability(el).whenStable(callback);
          return;
        }
        if (!window.angular) {
          throw new Error('window.angular is undefined.  This could be either ' +
              'because this is a non-angular page or because your test involves ' +
              'client-side navigation, which can interfere with Protractor\'s ' +
              'bootstrapping.  See http://git.io/v4gXM for details');
        }
        if (angular.getTestability) {
          angular.getTestability(el).whenStable(callback);
        } else {
          if (!angular.element(el).injector()) {
            throw new Error('root element (' + rootSelector + ') has no injector.' +
               ' this may mean it is not inside ng-app.');
          }
          angular.element(el).injector().get('$browser').
              notifyWhenNoOutstandingRequests(callback);
        }
      } catch (err) {
        callback(err.message);
      }
    }).apply(this, arguments); }
    catch(e) { throw (e instanceof Error) ? e : new Error(e); }, [body.ng-scope]])
    09:49:56.713 DEBUG [20] org.openqa.selenium.remote.RemoteWebDriver - Executing: executeAsyncScript [c9f64f66-fc8c-4f3d-a0be-535b63370dd0, executeAsyncScript {script=try { return (function (rootSelector, callback) {
      var el = document.querySelector(rootSelector);

      try {
        if (window.getAngularTestability) {
          window.getAngularTestability(el).whenStable(callback);
          return;
        }
        if (!window.angular) {
          throw new Error('window.angular is undefined.  This could be either ' +
              'because this is a non-angular page or because your test involves ' +
              'client-side navigation, which can interfere with Protractor\'s ' +
              'bootstrapping.  See http://git.io/v4gXM for details');
        }
        if (angular.getTestability) {
          angular.getTestability(el).whenStable(callback);
        } else {
          if (!angular.element(el).injector()) {
            throw new Error('root element (' + rootSelector + ') has no injector.' +
               ' this may mean it is not inside ng-app.');
          }
          angular.element(el).injector().get('$browser').
              notifyWhenNoOutstandingRequests(callback);
        }
      } catch (err) {
        callback(err.message);
      }
    }).apply(this, arguments); }
    catch(e) { throw (e instanceof Error) ? e : new Error(e); }, args=[body.ng-scope]}]
    09:49:56.714 DEBUG [20] org.apache.http.client.protocol.RequestAddCookies - CookieSpec selected: default
    09:49:56.715 DEBUG [20] org.apache.http.client.protocol.RequestAuthCache - Auth cache not set in the context
    09:49:56.715 DEBUG [20] org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection request: [route: {}->http://127.0.0.1:7055][total kept alive: 0; route allocated: 0 of 2000; total allocated: 0 of 2000]
    09:49:56.715 DEBUG [20] org.apache.http.impl.conn.PoolingHttpClientConnectionManager - Connection leased: [id: 12][route: {}->http://127.0.0.1:7055][total kept alive: 0; route allocated: 1 of 2000; total allocated: 1 of 2000]
    09:49:56.715 DEBUG [20] org.apache.http.impl.execchain.MainClientExec - Opening connection {}->http://127.0.0.1:7055
    09:49:56.716 DEBUG [20] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connecting to /127.0.0.1:7055
    09:49:56.716 DEBUG [20] org.apache.http.impl.conn.DefaultHttpClientConnectionOperator - Connection established 127.0.0.1:58730<->127.0.0.1:7055
    09:49:56.717 DEBUG [20] org.apache.http.impl.conn.DefaultManagedHttpClientConnection - http-outgoing-12: set socket timeout to 10800000
    09:49:56.717 DEBUG [20] org.apache.http.impl.execchain.MainClientExec - Executing request POST /hub/session/c9f64f66-fc8c-4f3d-a0be-535b63370dd0/execute_async HTTP/1.1
    09:49:56.717 DEBUG [20] org.apache.http.impl.execchain.MainClientExec - Target auth state: UNCHALLENGED
    09:49:56.717 DEBUG [20] org.apache.http.impl.execchain.MainClientExec - Proxy auth state: UNCHALLENGED
    09:49:56.717 DEBUG [20] org.apache.http.headers - http-outgoing-12 >> POST /hub/session/c9f64f66-fc8c-4f3d-a0be-535b63370dd0/execute_async HTTP/1.1
    09:49:56.717 DEBUG [20] org.apache.http.headers - http-outgoing-12 >> Content-Type: application/json; charset=utf-8
    09:49:56.718 DEBUG [20] org.apache.http.headers - http-outgoing-12 >> Content-Length: 1172
    09:49:56.718 DEBUG [20] org.apache.http.headers - http-outgoing-12 >> Host: 127.0.0.1:7055
    09:49:56.718 DEBUG [20] org.apache.http.headers - http-outgoing-12 >> Connection: Keep-Alive
    09:49:56.718 DEBUG [20] org.apache.http.headers - http-outgoing-12 >> User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_77)
    09:49:56.718 DEBUG [20] org.apache.http.headers - http-outgoing-12 >> Accept-Encoding: gzip,deflate
    09:49:56.718 DEBUG [20] org.apache.http.wire - http-outgoing-12 >> "POST /hub/session/c9f64f66-fc8c-4f3d-a0be-535b63370dd0/execute_async HTTP/1.1[\r][\n]"
    09:49:56.718 DEBUG [20] org.apache.http.wire - http-outgoing-12 >> "Content-Type: application/json; charset=utf-8[\r][\n]"
    09:49:56.718 DEBUG [20] org.apache.http.wire - http-outgoing-12 >> "Content-Length: 1172[\r][\n]"
    09:49:56.719 DEBUG [20] org.apache.http.wire - http-outgoing-12 >> "Host: 127.0.0.1:7055[\r][\n]"
    09:49:56.719 DEBUG [20] org.apache.http.wire - http-outgoing-12 >> "Connection: Keep-Alive[\r][\n]"
    09:49:56.719 DEBUG [20] org.apache.http.wire - http-outgoing-12 >> "User-Agent: Apache-HttpClient/4.5.1 (Java/1.8.0_77)[\r][\n]"
    09:49:56.719 DEBUG [20] org.apache.http.wire - http-outgoing-12 >> "Accept-Encoding: gzip,deflate[\r][\n]"
    09:49:56.719 DEBUG [20] org.apache.http.wire - http-outgoing-12 >> "[\r][\n]"
    09:49:56.719 DEBUG [20] org.apache.http.wire - http-outgoing-12 >> "{"script":"try { return (function (rootSelector, callback) {\n  var el = document.querySelector(rootSelector);\n\n  try {\n    if (window.getAngularTestability) {\n      window.getAngularTestability(el).whenStable(callback);\n      return;\n    }\n    if (!window.angular) {\n      throw new Error('window.angular is undefined.  This could be either ' +\n          'because this is a non-angular page or because your test involves ' +\n          'client-side navigation, which can interfere with Protractor\\'s ' +\n          'bootstrapping.  See http://git.io/v4gXM for details');\n    }\n    if (angular.getTestability) {\n      angular.getTestability(el).whenStable(callback);\n    } else {\n      if (!angular.element(el).injector()) {\n        throw new Error('root element (' + rootSelector + ') has no injector.' +\n           ' this may mean it is not inside ng-app.');\n      }\n      angular.element(el).injector().get('$browser').\n          notifyWhenNoOutstandingRequests(callback);\n    }\n  } catch (err) {\n    callback(err.message);\n  }\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }","args":["body.ng-scope"]}"
    09:50:25.970 DEBUG [13] org.openqa.selenium.remote.server.DriverServlet - Handling: DELETE /session/e92fa9f1-8822-4f27-85a2-9f929d484e4a
    09:50:25.971 INFO [13] org.openqa.selenium.remote.server.DriverServlet - Executing: [delete session: e92fa9f1-8822-4f27-85a2-9f929d484e4a])
webdriver-manager update
it('gets the homepage', function() {
    var homePageAddress = 'http://localhost';
    browser.get(homePageAddress)
    expect(browser.getCurrentUrl()).toContain('localhost');
});

it('clicks the link', function() {
    var someLink = element(by.css('.navigationpanel-element[translate="SomeText.SomeText"]'));
    someLink.click();
    expect(something).toBe(true);
});