2016-04-16 2 views
1
  • Knoten Version: 5.10.1
  • Protractor Version: 3.2.2
  • Browser: firefox v. 45.0.2
  • Betriebssystem Windows 8.1 x64
  • Angular auf Web-Anwendung ' 1.5.0 '
  • Selenserver' selen-server-standalone-2.53.0 '

Ich bin neu in Winkelmesser und mein Englisch ist schlecht. Die Situation: Ich habe einen Test (eigentlich Suite von Tests), die gegen Chrom geht, aber hängt fast sofort gegen Firefox, es hängt nach Klicks auf einen Link, nachdem es getan werden soll erwartet.Tests hängen, wenn gegen firefox läuft, aber die gleichen Tests complitly arbeiten mit Chrom

Testbeispiel:

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'); 
    } 
}; 

So wie ich gegen Chrom sagte, es funktioniert gut, aber wenn es gegen firefox läuft hängt es nach dem ersten Klick und auch das Browser-Fenster schließt nicht.

Protractor log sagt:

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. 

Erhöhung Timeout nicht Ergebnis nicht geben, das Verhalten gleich.

Ein Stück Selen-Servers log (Ende davon):

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]) 

Bitte helfen Sie, ich viel Zeit damit verbringen, um es zu lösen, kann ich einige Frage öffnen sollte? Aber ich bin nicht sicher, bestimmte Schritte zu definieren, um es ohne lokale Anwendung zu reproduzieren.

Aktualisiert

Das hier beschriebene Problem: https://github.com/seleniumhq/selenium-google-code-issue-archive/issues/4757

Stück log von meinem firefox-Treiber:

"level":"INFO","message":"[fxdriver.SyntheticMouse] Calling fireMouseEvent mousemove 397, 205, ","timestamp":1461003932367,"type":""} {"level":"INFO","message":"[fxdriver.SyntheticMouse] Calling fireMouseEvent mousedown 397, 205, ","timestamp":1461003932388,"type":""} {"level":"INFO","message":"[fxdriver.SyntheticMouse] Calling fireMouseEvent mouseup 397, 205, ","timestamp":1461003932408,"type":""} {"level":"INFO","message":"[fxdriver.SyntheticMouse] Calling fireMouseEvent click 397, 205, ","timestamp":1461003932454,"type":""} {"level":"INFO","message":"[fxdriver.Utils] Not loading document anymore.","timestamp":1461003932478,"type":""} {"level":"INFO","message":"[fxdriver.nsCommandProcessor] Received command: executeAsyncScript","timestamp":1461003932504,"type":""} {"level":"INFO","message":"[fxdriver.nsCommandProcessor] Received command: findElements","timestamp":1461003934754,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003934917,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003935029,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003935156,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003935279,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003935395,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003935518,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003935640,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003935757,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003935889,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003936015,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003936145,"type":""} {"level":"INFO","message":"[fxdriver.DelayedCommand] Ignoring pending about:document-onload-blocker request","timestamp":1461003936273,"type":""}

Aber ich weiß noch nicht, wie es zu lösen, was ist your comet request:

Antwort

1

Es gibt einige Gründe, warum dies passieren könnte. Mein erster Vorschlag wäre, sicherzustellen, dass der Webdriver auf dem neuesten Stand ist. Geben Sie diese in Ihrer Konsole:

webdriver-manager update 

Zweitens, wenn Sie das Timeout die Erhöhung der gleiche Verhalten erzeugt, haben Sie eigentlich eine längere Timeout sehen? Wenn es für 5 Sekunden pausiert (Standard), dann Jasmine ist es asynchron. http://jasmine.github.io/2.0/introduction.html#section-43

Ich würde versuchen (auch als eine gute Praxis), Ihre Tests in it Blöcke zu trennen.

Auf diese Weise kann der Winkelmesser den Kontrollfluss ein wenig besser handhaben.

Drittens, wenn diese nicht funktionieren, versuchen Sie vielleicht eine andere Möglichkeit, das Element zu finden. Ich kenne das Attribut translate nicht sehr gut, aber es scheint auch eine "experimentelle Technologie" zu sein und wird von keinem Browser gemäß MDN unterstützt.

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/translate

+0

Danke für die schnelle Antwort, ich aktualisiere Webdriver-Manager vor, auch ich habe versucht, die letzte Version von Selen-Server-Standalone zu verwenden, es hilft nicht. Und ich sehe ein längeres Timeout, wenn ich es vergrößere. Jetzt erkannte ich zwei Dinge: 1. Wenn "Winkelmesser" Seite lädt und dann einige erwartet, funktioniert es gut, auch wenn ich 'translate' Attribut verwende, aber ich muss nur hinzufügen, klicken Sie auf einen Link oder auf eine Schaltfläche, Es ist sofort nach hängen Klick und macht nach dem Klick nichts. – Niyarlatotep

+0

Dieser Fall funktioniert: \t 'es ('bekommt die Homepage', function() { \t \t var homePageAddress = 'http: // localhost'; \t \t browser.get (homePageAddress) \t \t erwarten (Browser . .getCurrentUrl()) toContain ('localhost'); \t}; ' \t Dieser Fall hat funktioniert nicht: \t' es ('klickt auf den Link', function() { \t \t var someLink = Element (by.css ('. navi gationpanel-element [translate = "SomeText.SomeText"]]); \t \t someLink.click(); \t \t erwarten (etwas) .zu sein (wahr); \t} ' – Niyarlatotep

+0

Wie gesagt, es hängt nach dem Klick, aber es gibt keine Probleme mit click(); im firefox verstehe ich nichts. Ich habe versucht, andere Locators zu verwenden und dasselbe Ergebnis zu erzielen. – Niyarlatotep

Verwandte Themen