2015-04-06 38 views
0

運行文件時量角器我得到這個錯誤:與CSS選擇==查找元素#linkreturned意外的錯誤

$ ./protractor config.js 
Using the selenium server at http://ie11.dev:4444/wd/hub 
[launcher] Running 1 instances of WebDriver 
F 

Failures: 

    1) test a simple mouseMove() it should show a popup 
    Message: 
    UnknownError: Finding elements with css selector == #linkreturned an unexpected error (WARNING: The server did not provide any stacktrace information) 
Command duration or timeout: 301 milliseconds 
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37' 
System info: host: 'WIN-A0RAN2MRA9O', ip: '172.16.196.133', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_31' 
Driver info: org.openqa.selenium.ie.InternetExplorerDriver 
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:33476/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}] 
Session ID: d59ae082-5864-4734-9df1-5f0dff04bb7b 
    Stacktrace: 
    UnknownError: Finding elements with css selector == #linkreturned an unexpected error (WARNING: The server did not provide any stacktrace information) 
Command duration or timeout: 301 milliseconds 
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37' 
System info: host: 'WIN-A0RAN2MRA9O', ip: '172.16.196.133', os.name: 'Windows 7', os.arch: 'x86', os.version: '6.1', java.version: '1.8.0_31' 
Driver info: org.openqa.selenium.ie.InternetExplorerDriver 
Capabilities [{browserAttachTimeout=0, enablePersistentHover=true, ie.forceCreateProcessApi=false, ie.usePerProcessProxy=false, ignoreZoomSetting=false, handlesAlerts=true, version=11, platform=WINDOWS, nativeEvents=true, ie.ensureCleanSession=false, elementScrollBehavior=0, ie.browserCommandLineSwitches=, requireWindowFocus=false, browserName=internet explorer, initialBrowserUrl=http://localhost:33476/, takesScreenshot=true, javascriptEnabled=true, ignoreProtectedModeSettings=false, enableElementCacheCleanup=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=dismiss}] 
Session ID: d59ae082-5864-4734-9df1-5f0dff04bb7b 
==== async task ==== 
WebDriver.findElements(By.cssSelector("#link")) 
==== async task ==== 
Asynchronous test function: it() 
Error 
    at [object Object].<anonymous> (/home/xxxxxxxxxxxx/protractortest/test.js:6:25) 
Error 
    at [object Object].<anonymous> (/home/xxxxxxxxxxxx/protractortest/test.js:2:3) 
    at Object.<anonymous> (/home/xxxxxxxxxxxx/protractortest/test.js:1:63) 

Finished in 2.04 seconds 
1 test, 1 assertion, 1 failure 

[launcher] 0 instance(s) of WebDriver still running 
[launcher] internet explorer11 #1 failed 1 test(s) 
[launcher] overall: 1 failed spec(s) 
[launcher] Process exited with error code 1 

test.js

describe('test a simple mouseMove()', function() { 
    it('it should show a popup', function() { 
     browser.ignoreSynchronization = true; 
     browser.driver.get('file:///C:/Users/xxxxxxxx/Documents/protractortest/index.html'); 
     browser.sleep(1000); 
     expect($("#link").isDisplayed()).toBeTruthy(); 
     // expect(element(by.id("link")).isDisplayed()).toBeTruthy(); 
     // browser.actions().mouseMove(element(by.id("link"))).perform(); 
     // browser.sleep(5000); 
     // expect($("#hover-div").isDisplayed()).toBeTruthy(); 
    }); 
}); 

指數。 html

http://pastie.org/private/mm4xedyqsw0vrpmm5gqwiw

硒:2.44 量角器:1.7.0 VM與IE11和Win7

本次測試的全部目的是檢查的mouseMove()的作品IE11下。但我無法選擇一個元素。

順便說一句,IE11在另一個項目中運行良好,所以在這個例子中我可能會丟失配置中的某些東西。但是另一個項目太複雜了,它有一個非常大的配置。

+0

與我目前的項目的一個重要區別是,在這個例子中,我沒有測試一個角度的應用程序,而是一個正常的HTML頁面。 – hhaamm

回答

0

我認爲問題在於我正在使用file://協議。我改爲http://(在我的主機上安裝Apache等,並從VM訪問),並且它工作正常。我想這是因爲在IE 11中的某種安全設置。我希望有一個更具描述性的錯誤。