问题
I am running selenium locally, but it is extremely slow on find and click.
test_helper.rb
Capybara.register_driver :selenium do |app|
Capybara::Selenium::Driver.new(app, browser: :chrome)
end
This is a test on my page:
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
However, the visit action is almost instantly.
I've tried another test:
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
end
And it worked.
How can I find the cause on my site? The new_user_session_path is devise's default template and controller.
回答1:
Had to disable Turbolinks. Capybara worked but was slow when executing commands through byebug
来源:https://stackoverflow.com/questions/41764935/selenium-slow-click-action-only-localhost