Superbara
Capybara CLI on Steroids
Install / Use
/learn @matti/SuperbaraREADME
Superbara
Web app test scripting that does not hurt.

- Stands on the shoulders of Capybara
- All batteries included: just start scripting, nothing extra required
- A powerful command line interface with interactive debugger
- The most natural test language that is still programming, see:
visit "mysite.com"
wait 3 do
has_text? "welcome"
end
scroll 20
click_link "enter"
name_field = find "input#name"
name_field.type "Sarah", :enter
if has_text? "Welcome, Sarah"
run "logout"
else
assert "no greeting visible"
end
Install & Usage
gem install superbara
superbara init example
superbara start example
superbara usage
Documentation
See https://matti.github.io/superbara for getting started and language reference.
Some things that Superbara does that Capybara does not:
# find+click in one line!
click 'h1'
# wait up to 3 seconds for block to return something else than nil or false
wait 3 do
has_text? "Welcome"
end
wait 3.1 do
find "#username"
end
# simulates real typing
textarea = find "textarea"
textarea.type "hello", :backspace, :backspace, :backspace, "sinki", :enter
# scrolling
scroll 50
scroll -20, duration: 4
# works also without http://
visit 'example.com'
# highlights when in interactive mode or SUPERBARA_VISUAL env is set
find "h1"
# runs project/file.rb
run "vars"
# possible to run just once per session (superbara start) to speed up
run "login", {}, once: true
# ..and do something when already ran
run "login", {}, once: true do
# when already logged in
visit "http://www.example.com/main"
end
# opens debugger when exception happens or when the test finishes or
debug
# back, forward, reload (and not only go_back, go_forward, refresh)
back
forward
reload
# natural sleeps, sleep between 2 and 4 seconds
think 2..4
Everything that works in Capybara, works in Superbara, see https://github.com/teamcapybara/capybara/#the-dsl
Quick Reference:
click_link 'id-of-link'
click_link 'Link Text'
click_button 'Save'
click_on 'Link Text' || click_on 'Button Value'
click_text 'get started'
find 'h1'
find_field('First Name').value
find_field(id: 'my_field').value
find_link('Hello', :visible => :all).visible?
find_link(class: ['some_class', 'some_other_class'], visible: :all).visible?
find_button('Send').click
find_button(value: '1234').click
find(:xpath, ".//table/tr").click
find("#overlay").find("h1").click
for a in all('a') do
if a[:href].include? "about"
a.click
end
end
img_boxed = find('img') do |el|
el['data-box'] == true
end
within '#menu' do
click 'a', text: 'Pricing'
end
within_table 'Employee' do
fill_in 'Name', with: 'Sarah'
end
within_fieldset 'Employee' do
...
end
facebook_window = window_opened_by do
click_button 'Like'
end
within_window facebook_window do
find('#login_email').type 'a@example.com'
find('#login_password').type 'qwerty'
click_button 'Submit'
end
execute_script "document.querySelector("#name").style.border = '1px solid red';"
value = evaluate_script "window.innerHeight"
accept_alert do
click_link 'Show Alert'
end
dismiss_confirm do
click_link 'Show Confirm'
end
message = accept_prompt with: 'Linda Liukas' do
click_link 'Author Quiz!'
end
message = 'Who is the author of Hello Ruby?'
has_selector? 'table tr'
has_no_selector? 'table tr'
has_selector? :xpath, './/table/tr'
has_xpath? './/table/tr'
has_no_xpath? './/table/tr'
has_css? 'table tr.foo'
has_no_css? 'table tr.foo'
has_content? 'foo'
has_no_content? 'foo'
has_text? 'foo'
has_no_text? 'foo'
fill_in 'First Name', with: 'Johwn'
choose 'A Radio Button'
check 'A Checkbox'
uncheck 'A Checkbox'
attach_file 'Image', File.join(Dir.pwd,'image.jpg')
select 'Option', from: 'Select Box'
Related Skills
node-connect
348.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
348.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
348.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
