Hot answers tagged

10 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.....
user avatar
  • 9,949
8 votes

Expect case insensitive text on page - Capybara + RSpec

have_content actually takes a regexp as parameter. You can use the i flag to make the search case insensitive expect(page).to have_content(/my case insensitive search/i)
user avatar
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; ...
user avatar
  • 9,949
5 votes

Which has the better support for Selenium, Python or Ruby?

As @Niels van Reijmersdal mentioned, it makes sense to use the language in which you have local experts available. But you don't have to use the same language - use the language in which your team ...
user avatar
5 votes

Is it possible to stop page loading on the browser using selenium web-driver?

If you are using firefox then you can set preference for default timeout: fp = webdriver.FirefoxProfile() fp.set_preference("http.response.timeout", 5) fp.set_preference("dom.max_script_run_time", 5) ...
user avatar
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 ...
user avatar
  • 9,720
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 ...
user avatar
  • 345
3 votes
Accepted

Selenium WebDriver sometimes fails to connect to the browser when running tests in headless mode

I was able to determine what was causing the issue. After new session initialization: session = Capybara::Session.new(driver) I was calling following method to maximise the browser window: session....
user avatar
3 votes

Which has the better support for Selenium, Python or Ruby?

In my opinion it's better to develop with the tools and languages that you love. Here are good Selenium recipes, code examples & API references for Ruby: http://samples.leanpub.com/...
user avatar
3 votes

Running script at the end of cucumber test

You can use the global hook at_exit: at_exit do your script goes here end For example, in features\support\env.rb I typically have: at_exit do browser.close end
user avatar
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 ...
user avatar
  • 30.8k
3 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: ...
user avatar
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/ ...
user avatar
  • 10.8k
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 ...
user avatar
2 votes
Accepted

Appium (iOS) how to choose two UITableCells with the same name

find_elements(:name,"Like")[0].click find_elements(:name,"Like")[1].click ... button(1).click button(2).click ... ele_index(:UIAButton,1).click ele_index(:UIAButton,2).click ... buttons[0].click ...
user avatar
2 votes

Getting response headers with Selenium Webdriver / Chromedriver

It may be easier to just openAndWait() the URL and do some conditional logic to see if the page displays a maintenance message or not. Incorporating a proxy (as mentioned in other responses) for this ...
user avatar
  • 4,030
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 ...
user avatar
  • 3,725
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 ...
user avatar
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.
user avatar
  • 179
2 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 ...
user avatar
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 ...
user avatar
  • 589
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 ...
user avatar
  • 9,949
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 ...
user avatar
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'. ...
user avatar
  • 181
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.
user avatar
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 ...
user avatar
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 ...
user avatar
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)
user avatar
1 vote
Accepted

ERROR at the time of capybara installation

The reason for this issue is because - There is an 'SSL' certificate error. When you try to connect to the 'rubygems.org' server via the command prompt, What you need to do is follow the ...
user avatar
1 vote
Accepted

Running tests in chrome but just getting data;. in every browser window

This was due to a bug in chromedriver. Updating to a more recent version solves this. Specifically this was fixed in chromedriver version 2.24 at least for Ubuntu. A couple of other of our ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible