Tag: selenium

Watir脚本偶尔会返回Net :: ReadTimeout错误

我有一个Watir脚本,偶尔和不可预测地返回此错误: Net::ReadTimeout 我搜索了这个错误,发现这个问题已经问过。 我按照最佳答案,实施了这个: attempts = 0 url = “https:/www.google.com/” begin doc = Watir::Browser.start url rescue Net::ReadTimeout retry end 但我仍然得到相同的超时错误。 我的网络从未遇到任何连接问题。 我在Ubuntu和Windows 10机器上都出错了。 在此错误表现出来之前,我的代码平均经历了大约30次迭代。 我正在使用Chrome。 有什么建议?

Selenium慢点击动作只有localhost

我在本地运行selenium,但在查找和点击时速度非常慢。 test_helper.rb中 Capybara.register_driver :selenium do |app| Capybara::Selenium::Driver.new(app, browser: :chrome) end 这是我页面上的测试: feature “dashboard” do include Warden::Test::Helpers scenario “test1”, :js => true do visit root_path visit new_user_session_path #any of this are super slow #find(“a[href=’#{/users/sign_up}’]”).click #page.find(:css, ‘a[href=”/users/passsword/new”]’).click #page.find(:xpath, “//a[@href=’/users/sign_up’]”).click end 但是,访问行动几乎是即时的。 我尝试过另一个测试: feature “dashboard” do include Warden::Test::Helpers scenario “test1”, :js => true do visit ‘http://www.google.com.uy’ page.find(:xpath, “//a[@href=’//www.google.com.uy/intl/es-419/about.html?fg=1′]”).click […]

如何防止Firefox以安全模式启动?

使用Selenium运行Rails测试套件通常会以“以安全模式启动?”打开Firefox。 对话。 有没有办法要么1)禁用它,或2)添加一个脚本,如果对话框出现,将回答“否”?

我运行黄瓜测试时出现黄瓜错误

我是ROR的新手。 我使用的是Ruby 1.9.2p290,rvm 1.10.2,chromedriver version = 18.0.995.0。 当我通过执行命令运行黄瓜测试时: 捆绑exec黄瓜function/ mytest.feature 我收到了以下错误消息 : (::)失败的步骤(::) proxy必须是字典类型,而不是null。 收到:null (selenium:: webdriver的::错误:: WebDriverError)

我应该使用Selenium还是Jasmine来测试RSpec的视图文件?

我正在使用Ruby on Rails 3.2.2,cucumber-rails-1.3.0,rspec-rails-2.8.1和capybara-1.1.2以及Selenium驱动程序。 在收到我之前的问题的答案后,我有一个疑问: 我应该使用Selenium ruby​​-gem还是Jasmine ruby​​-gem来测试RSpec的视图文件? 如果是这样,因为我已经使用Selenium来测试JavaScript用于Cucumber的视图文件, 为什么 (当使用RSpec测试时)我应该使用Jasmine而不是Selenium? 也就是说,为什么要使用两个具有相同目的并制造相同东西的ruby? 一般而言,实际上, 您如何建议使用RSpec测试视图文件? …但是,它是使用RSpec测试视图文件的“正确方法”还是应该使用Cucumber测试?

Selenium无法找到’spec’文件夹

因此,我正在尝试建立我的本地系统,以帮助完成仅使用rails的雇主的现有项目。 他们希望我主要关注rspec测试,因为项目几乎是function性的,我需要充实他们错过的东西。 但是,我无法获得’rake spec’来构建我的测试文件夹。 实际上,测试文件夹包含一些使用Selenium的基本用户登录测试(我没有写它们)。 以下是错误的跟踪: /opt/local/lib/ruby/gems/1.8/gems/selenium-client-1.2.18/lib/selenium/rspec/spec_helper.rb:2:in ‘require’: no such file to load — spec (LoadError) from /opt/local/lib/ruby/gems/1.8/gems/selenium-client-1.2.18/lib/selenium/rspec/spec_helper.rb:2 from /Users/cliffhess/ampms/spec/integration/user_registration_name_not_blank_spec.rb:5:in ‘require’ from /Users/cliffhess/ampms/spec/integration/user_registration_name_not_blank_spec.rb:5 from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in ‘load’ from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in ‘load_spec_files’ from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in ‘map’ from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/configuration.rb:386:in ‘load_spec_files’ from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/command_line.rb:18:in ‘run’ from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:55:in ‘run_in_process’ from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:46:in ‘run’ from /opt/local/lib/ruby/gems/1.8/gems/rspec-core-2.5.1/lib/rspec/core/runner.rb:10:in ‘autorun’ from /opt/local/lib/ruby/gems/1.8/bin/rspec:19 rake aborted! 事实上,我很确定我理解这个问题(也许?)。 selenium-clients的spec_helper.rb中的第2行说require ‘spec’ ,如果我没弄错的话,就是说selenium-client应该包含一个名为spec的文件夹,其中包含所有的rspec内容。 […]

我如何在Capybara w / selenium中使用ruby-debug

我们让Capybara使用selenium驱动程序但是当我尝试在步骤中使用“调试器”时它不太有效。 例如,在调试控制台中输入’page’有效,但输入’page.body’挂起。 在尝试使用akephalos驱动程序的调试器时,我们也很奇怪。 使用akephalos我们无法输入调试提示…实际上我们可以,但是你必须多次按键才能在终端中随机显示一个字母。 做’Ctrl-C’让我们输入,但是我们得到了’DRb connection … something’之类的错误(抱歉再也没有确切的错误)。 我认为问题是像selenium和akephalos这样的驱动程序在同一个进程中运行测试和服务器,它会混淆ruby-debug。 我将尝试单独运行服务器(脚本/服务器测试)并使用Capybara.app_host =’http:// localhost:3000’来查看是否会产生影响。 我尝试使用akephalos,但由于它刚刚启动了另一个进程内服务器,所以无法实现。 是否有人使用与Capybara和selenium的ruby-debug? 这对其他人有用吗? 我错过了一些明显的东西吗

Rails:Watir中的代理身份validation(Chrome驱动程序)

我试图在chrome webdriver中添加代理身份validation,它在下面的watir上运行: require ‘watir’ proxies = [‘–proxy-server=185.264.167.184:63109’, ‘–proxy-auth=username:password’] browser = Watir::Browser.new :chrome, :switches => proxies browser.goto(url) 当浏览器运行它仍然问我如下的用户名和密码: 问题是如何在watir上运行的chrome驱动程序中设置用户名和密码?

Rspec + Capybara可选择更改JS驱动程序

我使用poltergeist / phantomjs作为CI,但我希望能够选择将JS驱动程序更改为selenium以观察我的本地测试运行。 理想情况下,我想为这个默认的poltergeist设置一个命令行标志,但是能够运行rspec –driver = selenium(或类似的东西) 有任何想法吗?

Docker中的Capybara无头镀铬返回DevToolsActivePort文件不存在

我试图配置系统测试,以在selenium中使用无头铬。 我有以下水豚配置: # spec/support/capybara.rb Capybara.server = :puma, { Silent: true } RSpec.configure do |config| config.before(:each, type: :system) do driven_by :rack_test end config.before(:each, type: :system, js: true) do driven_by :selenium_chrome_headless, screen_size: [1400, 1400] end end 和以下Dockerfile(没有数据库,因为我正在使用主机): FROM ruby:2.5.1 RUN apt-get update RUN apt-get install -y wget git # Node RUN curl -sL https://deb.nodesource.com/setup_9.x | bash – […]