相关疑难解决方法(0)

"使用最新的selenium-webdriver无法在60秒内获得稳定的firefox连接"

我正在尝试使用Capybara和shoulda测试启用javascript的Rails页面.我的设置是在VirtualBox上运行的Ubuntu 11.10(和FireFox 7),Windows 7作为主机.我的宝石中有一个therubyracer.

我的测试代码如下所示:

context "with javascript" do
  setup do
    Capybara.current_driver = :selenium
  end

  should "handle javascript" do      
    visit '/'
    click_link 'Hi'
    assert page.has_content? "Hello"
  end
end
Run Code Online (Sandbox Code Playgroud)

(其中带有文本"Hi"的链接有一个简单的jQuery click()函数,可以将"Hello"写入另一个div;它可以正常工作)但测试报告:

unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
Exception `Selenium::WebDriver::Error::WebDriverError' at /usr/local/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.9.1/lib/selenium/webdriver/firefox/launcher.rb:77:in `connect_until_stable'
Run Code Online (Sandbox Code Playgroud)

我发现了这个问题,但我现在已经bundle update将capybara和selenium-webdriver(后者为2.9.1)和我仍然得到相同的错误.我该如何解决?

selenium capybara ruby-on-rails-3

20
推荐指数
1
解决办法
6884
查看次数

Selenium错误:未指定显示

我在debian虚拟盒中安装了selenium-server-standalone-2.42.2.jar

并安装了Firefox 29.0

并尝试使用phpunit运行以下脚本,phpunit是目录中唯一的文件:

<?php
class TestLogin extends PHPUnit_Extensions_Selenium2TestCase{

    public function setUp()
    {
            $this->setHost('localhost');
            $this->setPort(4444);
            $this->setBrowser('firefox');
            $this->setBrowserUrl('http://debian-vm/phpUnitTutorial');
    }

    public function testHasLoginForm()
    {
            $this->url('index.php');

            $username = $this->byName('username');
            $password = $this->byName('password');

            $this->assertEquals('', $username->value());
            $this->assertEquals('', $password->value());
    }
}
Run Code Online (Sandbox Code Playgroud)

我收到以下错误:

1) TestLogin::testHasLoginForm
PHPUnit_Extensions_Selenium2TestCase_WebDriverException: Unable to connect to host
127.0.0.1 on port 7055 after 45000 ms. Firefox console output:
Error: no display specified
Error: no display specified
Run Code Online (Sandbox Code Playgroud)

这是什么意思?

我已经多了几个线程,显然我必须做以下尝试:

1)在命令shell中键入它

export PATH=:0;
Run Code Online (Sandbox Code Playgroud)

结果:我得到了同样的错误.

2)我已经安装了vnc4server并将debian-vm:1作为应用程序然后设置export PATH=debian-vm:1运行它与realvnc并在查看器(这工作)我遇到了同样的问题.

testing firefox selenium

7
推荐指数
3
解决办法
2万
查看次数

var = Watir :: Browser.start'url'之后无法在IRB中使用变量

1.9.3-p327 :001 > require 'watir-webdriver'
=> true 
1.9.3-p327 :002 > b = Watir::Browser.new
Run Code Online (Sandbox Code Playgroud)

然后firefox启动,我无能为力.我的IRB不允许我输入新命令.

尝试了浏览器初始化的不同变体:

b = Watir::Browser.new :opera
b = Watir::Browser.new :firefox
b = Watir::Browser.start 'url'
Run Code Online (Sandbox Code Playgroud)

应该出现类似的东西:

=> #<OperaWatir::Browser:0x1496e57 @active_window=#<OperaWatir::Window:0x1eb1db2
@browser=#<OperaWatir::Browser:0x1496e57 ...>>,@driver=#
Java::ComOperaCoreSystems::OperaDriver:0xeabd2f>>
Run Code Online (Sandbox Code Playgroud)

但是控制台中没有输出.浏览器关闭60秒后,我得到以下输出:

1.9.3-p327 :002 > b = Watir::Browser.new
Selenium::WebDriver::Error::WebDriverError: unable to obtain stable firefox connection
in 60 seconds (127.0.0.1:7055)
Run Code Online (Sandbox Code Playgroud)

试过chrome,firefox,浏览器打开,但是irb锁定.

操作系统:Ubuntu的

Ruby:2.0.0(也在1.9.3上试过)

ruby irb watir watir-webdriver

5
推荐指数
1
解决办法
758
查看次数

travis ci和selenium-webdriver无法在60秒内获得稳定的firefox连接(127.0.0.1:7055)

我有一个我正在研究的博客,我添加了一些javascript,以便在您点击新帖子时弹出博客的表单.一切正常.我使用minitest和capybara进行测试,我安装了gem selenium-webdriver,当我在本地测试时,一切正常.但是,当我推送到Github并且travis-ci接收我的信息并运行我的测试时,它给了我这个错误

unable to obtain stable firefox connection in 60 seconds (127.0.0.1:7055)
Run Code Online (Sandbox Code Playgroud)

我有点困惑,因为我在本地得到了这个错误,直到我更新到gem selenium-webdriver到版本2.39.0.我刚刚下载了firefox,据我所知,一切都是最新的.这是我的一些文件,如果这有帮助.

我的考试

feature "as a student I want a working blog so people can post" do
# this is line 10
  scenario "User can make a post", :js => true do
    dude_sign_up
    dude_log_in
    visit posts_path
    click_on "New Post"
    create_post
    page.must_have_content "Post was successfully created"
  end
# this is line 19
Run Code Online (Sandbox Code Playgroud)

的Gemfile

group :development, :test do
  gem 'sqlite3'
  gem 'minitest-rails'
  gem 'launchy'
  gem 'coveralls', require: false
  gem 'minitest-rails-capybara' …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails minitest capybara travis-ci selenium-webdriver

2
推荐指数
1
解决办法
1941
查看次数

在Ruby中使用浏览器作为GUI

在vbscript中,通常使用浏览器(IE)作为GUI.请参阅下面的示例,它要求输入名称并将其返回给脚本.在Ruby中你有一些像Tcl和Shoes这样的GUI,但我想知道如何在浏览器中这样做.什么是最简单的Ruby解决方案?所以没有exta gems或package,没有已经运行的服务器..如果需要gem,最好是在Windows中运行而没有问题.

这里是vbscript示例

Set web = CreateObject("InternetExplorer.Application")
If web Is Nothing Then
  msgbox("Error while loading Internet Explorer")
  Wscript.Quit
Else
  with web
    .Width = 300
    .Height = 175
    .Offline = True
    .AddressBar = False
    .MenuBar = False
    .StatusBar = False
    .Silent = True
    .ToolBar = False
    .Navigate "about:blank"
    .Visible = True
  end with
End If

'Wait for the browser to navigate to nowhere
Do While web.Busy
  Wscript.Sleep 100
Loop

'Wait for a good reference to the browser document
Set doc = …
Run Code Online (Sandbox Code Playgroud)

ruby vbscript user-interface internet-explorer

1
推荐指数
1
解决办法
3154
查看次数