12
votes
Accepted
How can I run one spec 100 times using the command line?
If you are using zsh shell:
repeat 10 { command }
On basic shell:
for _ in {1..10} do command; done
If you can run the tests in parallel, you can use the GNU Parallel:
parallel command ::: {1.....
7
votes
Accepted
Force a browser's visibility setting to true
It's possible to force this status with a Javascript injection via execute_script.
To simulate a visible document:
Object.defineProperty(document, 'visibilityState', {value: 'visible', writable: ...
6
votes
Accepted
Why does element.displayed? throws exception instead of boolean false?
$driver.find_element(:xpath,element2)
Above, you are trying to find an element.
.displayed?
Now you are trying to check the state in a element.
The exception is thrown by the first computation; ...
5
votes
Accepted
What are the differences between capybara and watir
Watir is Object Oriented while capybara is domain specific.
Capybara is simple to use, quick to deploy but maintenance will be an issue over time.
Watir needs overhead to develop its page ...
3
votes
Why are intermittent browser automation failures hard to fix and how to overcome that?
Intermittent failures are hard to fix due to their very nature - they don't always happen. So when you think you have fixed them you often can't be sure just by 'running the spec'. You usually need ...
3
votes
Accepted
Test automation script with ruby, watir-webdriver to run in Safari browser in Windows?
No
The highest version of Safari for Windows is too old. It's also not able to handle many modern web technologies, so you're better off using either a containerized version of Safari, or sticking to ...
3
votes
Why does element.displayed? throws exception instead of boolean false?
You are checking that an element that doesn't exist is displayed. Elements must exist if they are displayed so you are failing before you get to the .display?
For the findElement part, you need to ...
3
votes
Selenium with Ruby: Script not finding options in a drop-down
Add an explicit wait after you click your menu and then once the drop-down element is present refer below steps:
https://selenium.dev/docs/site/en/support_packages/working_with_select_elements/
...
3
votes
Accepted
Are Characterization (Golden Master/Snapshot) tests supposed to be human readable?
Generally, characterisation tests are not an end state. They're a way to pin the current behaviour of untested legacy code, so that you can start making changes towards maintainability and testability ...
2
votes
How can I run one spec 100 times using the command line?
Create a script in your home directory, e.g.
$ cat run_spec_100_times.sh
cd ~/eq/lynx
for i in `seq 1 100`;
do
rspec spec/features/survey_spec.rb
done
cd ~
Modify ...
2
votes
Upgrade from Selenium 2.53 to 3.0.0
Selenium 3.0 is a drop-in replacement, so it's as simple as updating your Gemfile to use the latest version of Selenium-WebDriver (and any other libraries you want). Then run your package manager to ...
2
votes
What are the differences between capybara and watir
I have asked similar question here on watir Github: What are known reasons to use watir not capybara?
You may find something useful there.
2
votes
Accepted
Page Object Model with Ruby and Selenium(Capybara)?
Even though you might not be re-using elements on multiple pages, or re-use the same pages for different tests (that's how I understand it), I would say using the POM still has benefits:
The code is ...
2
votes
Page Object Model with Ruby and Selenium(Capybara)?
POM can be useful to avoid unnecessary refactoring.
For your development stack I would suggest installing the site_prism gem - it allows you to easily create and compose page objects.
In this Pull ...
2
votes
Why do rspec-capybara chrome tests run headless fail on my mac and how to diagnose/fix it?
To debug, first try to take a screenshot in headless mode when you arrive at the button. Then take another screenshot before the test fails or after you click the button.
It really looks like you ...
2
votes
Test Automation tool able to determine object properties in desktop based application made with Ruby
I write test suites in Ruby using Rspec and Selenium. This does not mean that I must use Ruby to write automated tests for code written in Ruby. There's no need to choose your automation tool based on ...
2
votes
Accepted
What would switching from ruby rspec to minitest involve?
Minitest and Rspec are very similar. You are likely to miss the Rspec matchers, however there is an Rspec matchers gem for minitest. If you use it, there is a good chance your test will 'just work'.
...
2
votes
How to assert that all input fields are clear from a web page form after being reset?
Step 0. Set up Webdriver.
require 'rubygems'
require 'selenium-webdriver'
driver = Selenium::WebDriver.for :chrome
Step 1. Set a variable for finding values found_values= false
Step 2. Get an ...
2
votes
How to emulate right click options by Capybara?
If it's the system right click menu then you can't. If it's a page generated right click menu then you just interact like any other element on the page.
2
votes
Coding assignment for Ruby QA job?
I'm not the most experienced guy when it comes to interviews, but this is my opinion on the subject.
I like to separate personal interviews and assignments.
Personal Interviews
For me personal ...
2
votes
Accepted
What is the name for the 'describe it' format in testing?
I've generally seen it referred to as "xSpec"; that style was popularised, if not invented, by RSpec and there are others like JSpec (for Java, which uses it but not describe).
The JavaScript ...
1
vote
How to clear text field in Appium 1.8.0?
I've seen this particular situation reported by various users and the general consensus solution is to manually determine the length of the existing text contents, then literally send one delete ...
1
vote
Force a browser's visibility setting to true
The browser being the topmost app on the OS is actually (what I would call) a meta state that is outside of Selenium's scope of dealing with apps and browser settings.
So, if you really need the ...
1
vote
How do I configure my env.rb file to be able to switch browsers?
At the end of each scenario, you should be quitting the driver instance during teardown:
$driver.quit
1
vote
Accepted
How to implement the page-objects ruby gem with selenium
It looks like page-object is using the Watir implementation instead of the Webdriver implementation, and since Webdriver does not have a text_field property (while Watir does) it is failing. I am not ...
1
vote
Automation testing tools for non-GUI installer written in Ruby script on Mac and Windows
The classic tool for testing of interative non-GUI applications is called expect. It comes from the Tcl world but Ruby equivalents are available as well:
https://github.com/abates/ruby_expect
1
vote
Selenium Ruby - How to find a radio button by name and value?
If you familiar with css you can use css selector format
driver.find_element(:css,"[name='radioBtn'][value='1']")
1
vote
Accepted
What ruby automation options (capybara, watir) will let me use Selenium 3?
Here are the listed dependencies (as of 6/14/2017)
capybara
selenium-webdriver < 4.0, >= 2.0
Except version 3.4.1 due to this issue.
s.add_development_dependency("selenium-webdriver", [">= ...
1
vote
Accepted
XPath of an element keeps changing when testing in different OS or device
Yes, identify your element with an ID, class, name or other specific attribute.
XPath should only be used as a last resort, or if the selector is really complex and/or contains dynamic data. But even ...
1
vote
Accepted
How to Get Rid of Save Password Popup in Chrome (Ruby)
Try the following code:
prefs = {
credentials_enable_service: false
}
Selenium::WebDriver.for(:remote, url: grid_url, :desired_capabilities => caps, prefs: prefs)
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
ruby × 83selenium-webdriver × 49
automated-testing × 25
cucumber × 14
capybara × 14
rspec × 11
watir-webdriver × 6
page-objects × 5
chromedriver × 5
chrome × 5
appium × 4
jenkins × 4
watir × 4
selenium2 × 3
python × 3
browser-automation × 3
unit-tests × 3
sql × 3
ruby-on-rails × 3
xpath × 2
ios × 2
database × 2
windows × 2
java × 1
test-automation-framework × 1