我正在爲GWT應用程序寫入自動測試。我嘗試雙擊表格元素。我使用此代碼FO點擊:嘗試使用watir-webdriver雙擊元素的Native Events錯誤
browser.element(:xpath, '/html/body/div[5]/div[2]/div/div/div/div[2]/div/div/div/div/div/div/div/div[2]/div/div[2]/div/div/table/tbody[2]/tr[1]/td[1]/div').double_click
當執行此命令,我得到錯誤,如:
test_search(TC_article_example):Selenium::WebDriver::Error::InvalidElementStateError: Cannot perform native interaction: Could not load native events component.
[remote server] file:///C:/Users/TOMASZ~1.RYB/AppData/Local/Temp/webdriver-profile20130403-4556-12yrrcd/extensions/[email protected]/components/driver_component.js:8577:in `generateErrorForNativeEvents'
[remote server] file:///C:/Users/TOMASZ~1.RYB/AppData/Local/Temp/webdriver-profile20130403-4556-12yrrcd/extensions/[email protected]/components/driver_component.js:8610:in `FirefoxDriver.prototype.mouseMove'
[remote server] file:///C:/Users/TOMASZ~1.RYB/AppData/Local/Temp/webdriver-profile20130403-4556-12yrrcd/extensions/[email protected]/components/command_processor.js:10275:in `DelayedCommand.prototype.executeInternal_/h'
[remote server] file:///C:/Users/TOMASZ~1.RYB/AppData/Local/Temp/webdriver-profile20130403-4556-12yrrcd/extensions/[email protected]/components/command_processor.js:10280:in `DelayedCommand.prototype.executeInternal_'
[remote server] file:///C:/Users/TOMASZ~1.RYB/AppData/Local/Temp/webdriver-profile20130403-4556-12yrrcd/extensions/[email protected]/components/command_processor.js:10220:in `DelayedCommand.prototype.execute/<'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/response.rb:52:in `assert_ok'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/http/common.rb:59:in `new'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/http/common.rb:59:in `create_response'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/http/default.rb:66:in `request'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/bridge.rb:616:in `raw_execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/bridge.rb:594:in `execute'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/remote/bridge.rb:389:in `mouseMoveTo'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/mouse.rb:54:in `move_to'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/action_builder.rb:344:in `block in perform'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/action_builder.rb:343:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.31.0/lib/selenium/webdriver/common/action_builder.rb:343:in `perform'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.2/lib/watir-webdriver/elements/element.rb:181:in `hover'
C:/Watir/polisy.rb:27:in `test_search'
我加入這個代碼給我的腳本,但是這並沒有幫助:
profile = Selenium::WebDriver::Firefox::Profile.new
profile.native_events = false
browser = Watir::Browser.new :firefox, :profile => profile
請給我點建議。我用硒2.31,watir 4.0和firefox 19.0.2。 PS:對不起,我的英文不好。
您可以向我們展示您嘗試點擊的區域中的html嗎? –
是否有一個使用相同GWT事物的示例代碼頁面?或者使用類似的控件來處理你所使用的?沒有HTML或更好的網站,現在很難提出許多選擇。 –
你不能使用watir 4.0,你必須使用一些watir-webdriver的風格來支持Firefox。你能否提供watir-wevdriver的版本以及正在使用的webdriver的版本?最特別的是,因爲你的FF版本是非常新的,請確保webdriver的內容是最新的。 –