【问题标题】:selenium webdriver opens two pages, but tests on the empty pageselenium webdriver打开两个页面,但在空页面上测试
【发布时间】:2012-04-03 07:54:03
【问题描述】:

我有一个看起来像的硒测试

require 'spec_helper'

driver = Selenium::WebDriver.for :firefox

describe '' do
   it '', :js => true do
     visit 'http://0.0.0.0:3000/'                                           
     wait = Selenium::WebDriver::Wait.new(:timeout => 10) # seconds       
     wait.until { driver.find_element(:tag_name => 'svg' ) }
  end
end

当我打开这两个 Firefox 网页时,一个空白,另一个访问正确的页面 driver.page_source 似乎是

<html xmlns=\"http://www.w3.org/1999/xhtml\"><head></head><body></body></html>

这将对应于空白页。

【问题讨论】:

    标签: ruby-on-rails ruby selenium rspec


    【解决方案1】:

    visit 调用第二个页面进行渲染。执行driver.get 而是重定向了测试页面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-05-10
      • 2015-08-31
      • 1970-01-01
      • 1970-01-01
      • 2018-05-01
      相关资源
      最近更新 更多