我正在使用watir-webdriver驅動IE來測試另一個網站使用SSL證書的網站。 (同一個網站的量產版)Watir無法清除IE安全警告
當我訪問我的網站,我得到一個頁面,看起來像這樣(由於安全證書是壞的)
的的Watir文檔有此http://wiki.openqa.org/display/WTR/Security+Alerts 一種解決方法my_browser.link(:id,「overridelink」)。點擊
當我嘗試在ruby控制檯中運行這個時,出現錯誤。
irb(main):050:0> b.link(:id, "overridelink").click
Selenium::WebDriver::Error::UnexpectedJavascriptError: Unable to find element with xpath == .//a[@id='overridelink']
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/remote/response.rb:45:in `assert_ok'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/remote/response.rb:15:in `initialize'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/remote/http/common.rb:54:in `new'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/remote/http/common.rb:54:in `create_response'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/remote/http/default.rb:64:in `request'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/remote/http/common.rb:35:in `call'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/remote/bridge.rb:410:in `raw_execute'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/remote/bridge.rb:388:in `execute'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/remote/bridge.rb:356:in `find_element_by'
from C:/Ruby187/lib/ruby/gems/1.8/gems/selenium-webdriver-2.8.0/lib/selenium/webdriver/common/search_context.rb:41:in `find_element'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.5/lib/watir-webdriver/locators/element_locator.rb:86:in `find_first_by_multiple'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.5/lib/watir-webdriver/locators/element_locator.rb:33:in `locate'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.5/lib/watir-webdriver/elements/element.rb:263:in `locate'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.5/lib/watir-webdriver/elements/element.rb:245:in `assert_exists'
from C:/Ruby187/lib/ruby/gems/1.8/gems/watir-webdriver-0.3.5/lib/watir-webdriver/elements/element.rb:65:in `click'
from (irb):50
from :0irb(main):051:0>
當您查看錯誤頁面的html時,continue鏈接肯定存在。
<tr>
<td > </td>
<td id="continueToSiteAlign" align="left" valign="middle">
<h4 id="continueToSite">
<img src="red_shield.png" ID="ImgOverride" border="0" alt="Not recommended icon" class="actionIcon"><A href='' ID="overridelink" NAME="overridelink" >Continue to this website (not recommended).</A>
</h4>
</td>
</tr>
有誰知道如何解決這個問題?
該頁面是在主瀏覽器實例中顯示,還是彈出一個新窗口? –