How to use current_host method of Capybara Package

Best Capybara code snippet using Capybara.current_host


Source:current_host_spec.rb Github


Full Screen

1shared_examples_for "current_host" do2 after do3 Capybara.app_host = nil4 end5 describe '#current_host' do6 it "is affected by visiting a page directly" do7 @session.visit('')8 @session.body.should include('Current host is')9 @session.current_host.should == ''10 end11 it "returns to the app host when visiting a relative url" do12 Capybara.app_host = ""13 @session.visit('')14 @session.body.should include('Current host is')15 @session.current_host.should == ''16 @session.visit('/host')17 @session.body.should include('Current host is')18 @session.current_host.should == ''19 end20 it "is affected by setting Capybara.app_host" do21 Capybara.app_host = ""22 @session.visit('/host')23 @session.body.should include('Current host is')24 @session.current_host.should == ''25 Capybara.app_host = ""26 @session.visit('/host')27 @session.body.should include('Current host is')28 @session.current_host.should == ''29 end30 it "is unaffected by following a relative link" do31 @session.visit('')32 @session.click_link('Relative Host')33 @session.body.should include('Current host is')34 @session.current_host.should == ''35 end36 it "is affected by following an absolute link" do37 @session.visit('')38 @session.click_link('Absolute Host')39 @session.body.should include('Current host is')40 @session.current_host.should == ''41 end42 it "is unaffected by posting through a relative form" do43 @session.visit('')44 @session.click_button('Relative Host')45 @session.body.should include('Current host is')46 @session.current_host.should == ''47 end48 it "is affected by posting through an absolute form" do49 @session.visit('')50 @session.click_button('Absolute Host')51 @session.body.should include('Current host is')52 @session.current_host.should == ''53 end54 it "is affected by following a redirect" do55 @session.visit('')56 @session.body.should include('Current host is')57 @session.current_host.should == ''58 end59 end60end...

Full Screen

Full Screen


Using AI Code Generation


Full Screen

1puts page.driver.browser.manage.window.resize_to(100, 100)2puts page.driver.browser.manage.window.move_to(100, 100)3puts page.driver.browser.manage.window.resize_to(800, 600)4puts page.driver.browser.manage.window.move_to(0, 0)5puts page.driver.browser.manage.window.resize_to(1024, 768)6puts page.driver.browser.manage.window.resize_to(1280, 1024)7puts page.driver.browser.manage.window.resize_to(1366, 768)8puts page.driver.browser.manage.window.resize_to(1920, 1080)9puts page.driver.browser.manage.window.resize_to(2560, 1440)

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:


You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Capybara automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?