【问题标题】:Selenium test triggers second instance of FirefoxSelenium 测试触发 Firefox 的第二个实例
【发布时间】:2014-12-04 21:20:19
【问题描述】:

我在使用 FF 33.1 的 Mac 上。测试套件以及其他 gem 使用 Selenium、Capybara 和 VCR。出于某种原因,测试触发了 Firefox 的第二个实例(我认为这导致大多数测试失败):

Selenium::WebDriver::Error::WebDriverError:
       unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)

是什么导致了第二个实例,我该怎么办?我已经更新了 selenium-webdriver gem 并完成了捆绑安装。

这是一个触发行为的示例文件:

require "spec_helper"

  describe 'Managing Sections' do
    use_vcr_cassette

    before do
      @user = FactoryGirl.create :user
      @organization = FactoryGirl.create :organization
      @membership = FactoryGirl.create :membership, :organization => @organization, :user => @user, :role => 'admin'
      @bulletin = Bulletin.create(organization: @organization, user: @user, title: 'Test Title', created: true, publish_date: '2013-5-12')
      login_user @user
      visit manage_organization_bulletin_sections_path(@organization, @bulletin)
    end

    it 'creates a organization section for mtb', js: true do
      @organization.sections.count.should eq 0
      @bulletin.included_sections.count.should eq 4
      click_link 'multi-button'
      fill_in 'Title', with: 'New MTB'
      fill_in 'Description', with: 'New MTB Desc'
      click_button 'Save'
      @organization.sections.count.should eq 1
      @bulletin.reload
      @bulletin.included_sections.count.should eq 5
    end


    it 'creates a organization section for stb', js: true do
      @organization.sections.count.should eq 0
      @bulletin.included_sections.count.should eq 4
      click_link 'single-button'
      fill_in 'Title', with: 'New STB'
      fill_in 'Description', with: 'New STB Desc'
      click_button 'Save'
      @organization.sections.count.should eq 1
      @bulletin.reload
      @bulletin.included_sections.count.should eq 5
    end



it 'creates a organization section for bis', js: true do
  @organization.sections.count.should eq 0
  @bulletin.included_sections.count.should eq 4
  click_link 'insert-button'
  fill_in 'Title', with: 'New BIS'
  fill_in 'Description', with: 'New BIS Desc'
  click_button 'Save'
  @organization.sections.count.should eq 1
  @bulletin.reload
  @bulletin.included_sections.count.should eq 5
end


it 'creates a organization section for cal', js: true do
  @organization.sections.count.should eq 0
  @bulletin.included_sections.count.should eq 4
  click_link 'calendar-button'
  fill_in 'Title', with: 'New CAL'
  fill_in 'Description', with: 'New CAL Desc'
  click_button 'Save'
  @organization.sections.count.should eq 1
  @bulletin.reload
  @bulletin.included_sections.count.should eq 5
end


describe 'Deleting MTBS' do
  before do
    visit manage_organization_bulletin_sections_path(@organization, @bulletin)
    click_link 'multi-button'
    fill_in 'Title', with: 'New MTB'
    fill_in 'Description', with: 'New MTB Desc'
    click_button 'Save'
    @bulletin.reload
    @organization.reload
  end

  it 'doesnt delete org mtb when more than one clone present', js: true do
    pending
    visit manage_organization_bulletin_sections_path(@organization, @bulletin)
    click_link 'multi-button'
    fill_in 'Title', with: 'New MTB2'
    fill_in 'Description', with: 'New MTB2 Desc'
    click_button 'Save'
    @bulletin.reload
    @organization.reload
    visit manage_organization_bulletin_sections_path(@organization, @bulletin)
    within '#multi_text_block_' + @bulletin.included_sections.last._id.to_s do
      click_link 'delete_section'
      page.driver.browser.switch_to.alert.accept
    end
    @bulletin.reload
    @organization.reload.sections.count.should eq 1
    visit manage_organization_bulletin_sections_path(@organization, @bulletin)
    within '#multi_text_block_' + @bulletin.included_sections.last._id.to_s do
      click_link 'delete_section'
      page.driver.browser.switch_to.alert.accept
    end
    @organization.reload.sections.count.should eq 0
  end

  it 'deletes org mtb when one clone present'
end


it 'doesnt delete org stb when more than one clone present'
it 'deletes org stb when one clone present'
it 'doesnt delete org bis when more than one clone present'
it 'deletes org bis when one clone present'
it 'doesnt delete org cal when more than one clone present'
it 'deletes org cal when one clone present'

结束

【问题讨论】:

  • 不看你的代码我们怎么知道?

标签: ruby firefox selenium


【解决方案1】:

我相信 Firefox 的 32-34 版本会导致您使用的 gem 集出现此问题。

https://code.google.com/p/selenium/issues/detail?id=7642

【讨论】:

  • 降级到 FF 31 并且它可以工作......但是,它仍然会触发一个单独的 FF 实例???
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-08-12
  • 1970-01-01
  • 2020-01-04
  • 1970-01-01
相关资源
最近更新 更多