2013-04-06 59 views
0

我使用的NodeJS,純鹼硒硒的webdriver IE9事件不觸發

我打試圖讓JavaScript的火像數據的輸入事件的問題。腳本甚至無法通過在IE上創建客戶端流。只擔心IE 9+順便說一句。

我錯過了什麼?這在最新的FF中運行良好。下面張貼使用FF的示例代碼

var soda = require('soda'); 
var assert = require('assert'); 
var browser = soda.createClient({ 
    url: 'http://192.168.12.1/', // localhost website 
    port:5555, 
    host:'192.168.1.3', //grid ip 
    browser: 'firefox', 
    browserTimeout:5 
}); 

var testname = 'Nits' + parseInt(Math.random() * 100000000); //create unique name for new person. 
console.log('randome name: ' + testname); 

browser 
    .chain 
    .session() 
    .setSpeed(speed) 
    .setTimeout(20000) 
    .open('/') 
    .and(login('[email protected]', 'x1212GQtpS')) 
    .and(killClient(killAtEnd)) 
    .end(function(err){ 
     console.log('done'); 
     if(err){ 
      console.log(err); 
     }else{ 
      console.log("We're Good"); 
     } 
     if (closeAtEnd){ 
      browser.testComplete(function() { 
       console.log('killing browser'); 
      }); 
     } 
    }); 

function login(user, pass) { 
    return function(browser) { 
    browser 
    .click('css=a#loginButton') 
    .type('css=input.input-medium.email',user) 
    .type('css=input.input.pwd',pass) 
    .clickAndWait('css=a.btn.login') 
    .assertTextPresent('Clients',function(){ console.log('logged in ok')}) 
    } 
} 

回答

0

您能更具體地瞭解腳本停止,失敗或引發錯誤的具體位置嗎?我懷疑IE無法處理你把css選擇器放在一起的方式(比如'input.input.pwd'這樣的類名組合器)。我會建議嘗試一個不同的選擇器或重寫/簡化你現有的選擇器,直到你得到它的工作。

+0

感謝您的回覆,我想爲IE和Firefox使用相同的腳本是可能的嗎? – 2013-04-08 03:05:45

+0

是的。如果你的cssSelector正確,它可以在所有的瀏覽器上運行。根據我的經驗,如果一個帶clas值的DIV值爲「輸入輸入pwd」,那麼代替選擇器「DIV.input.input.pwd」,我簡化爲「DIV.input」。故事的士氣是要小心你的選擇器語法。 – djangofan 2013-04-08 16:18:36