capybara

Selecting element from dropdown without id Capybara

允我心安 提交于 2020-01-06 12:51:11
问题 I am trying to use capybara (ruby bindings) to select an item from a dropdown that does not have an id or unique class, but I seem to be unable to do so. The select box in question looks like this: <select data-bind="options: environments, optionsText: 'name', value: selectedEnvironment, optionsCaption: 'Choose...'" class="form-control"> Trying to do a: select("option",:from "#panel > div.panel-body > form > div:nth-child(1) > select") does not work, but I am able to find the select field

Selecting element from dropdown without id Capybara

廉价感情. 提交于 2020-01-06 12:50:50
问题 I am trying to use capybara (ruby bindings) to select an item from a dropdown that does not have an id or unique class, but I seem to be unable to do so. The select box in question looks like this: <select data-bind="options: environments, optionsText: 'name', value: selectedEnvironment, optionsCaption: 'Choose...'" class="form-control"> Trying to do a: select("option",:from "#panel > div.panel-body > form > div:nth-child(1) > select") does not work, but I am able to find the select field

How to get @tag in step definition from scenario ? - Ruby

老子叫甜甜 提交于 2020-01-05 15:06:55
问题 How to get tags from scenario into step definition in Ruby? **@TAGS** Scenario: Showing information of the scenario When I execute any scenario Now my step definition is this: And(/^When I execute any scenario$/) do |page| How to get tag = @TAGS in step definition.. end 回答1: Not a direct solution, but hooks (Before, After, AfterStep, etc) can be set to run for specific tags, which allows you to set instance variables that are accessible in the scenario Before('@my_tag') do # will only run if

How to get @tag in step definition from scenario ? - Ruby

旧城冷巷雨未停 提交于 2020-01-05 15:06:21
问题 How to get tags from scenario into step definition in Ruby? **@TAGS** Scenario: Showing information of the scenario When I execute any scenario Now my step definition is this: And(/^When I execute any scenario$/) do |page| How to get tag = @TAGS in step definition.. end 回答1: Not a direct solution, but hooks (Before, After, AfterStep, etc) can be set to run for specific tags, which allows you to set instance variables that are accessible in the scenario Before('@my_tag') do # will only run if

Capybara test failing with AJAX response

ⅰ亾dé卋堺 提交于 2020-01-05 10:30:19
问题 I have the following Capybara test, which should click through and change the content of a comment. The issue is that the content form is loaded into a modal that pops up upon clicking the edit button, and my modal isn't being rendered in the test. (This functionality works in the app). save_and_open_page opens a page containing just the json object. feature_spec.rb require 'spec_helper' describe 'Edit comment' do let(:commented_post) { FactoryGirl.create(:post_with_comments) } describe "when

How to get poltergeist/PhantomJS to delay returning the page to Capybara until AJAX is loaded?

て烟熏妆下的殇ゞ 提交于 2020-01-04 15:27:54
问题 How do I keep PhantomJS from returning the page to Capybara for several seconds to allow AJAX to finish loading? The HTML body I am getting back is: <!--div class='loading'>PLEASE WAIT WHILE PAGE LOADS</div--> Which is telling me that PhantomJS returned the page before the page finished loading its AJAX assets. Is there any way I can slow this down? I've tried using the rasterize.js solution but it looks as though any script I add to poltergeist's "phantomjs_options" hash is overlooked. 回答1:

Cucumber/Capybara: tests fail randomly under PhantomJS

一世执手 提交于 2020-01-04 09:57:07
问题 When I run cucumber scenarios under PhantomJS I get Capybara::ElementNotFound: Unable to find css ".given_class" exceptions in random places it looks like driver does not wait for element appearance I'm using: Ruby 2.0 Cucumber 1.3.6 Capybara 2.1.0 Selenium-webdriver 2.35.1 PhantomJS 1.9.1 回答1: Capybara, particularly with PhantomJS will load a page really quickly, and perform checks for elements. As such, some elements may not have loaded and tests fail. By default capybara has a wait time of

Cucumber/Capybara: tests fail randomly under PhantomJS

烂漫一生 提交于 2020-01-04 09:56:50
问题 When I run cucumber scenarios under PhantomJS I get Capybara::ElementNotFound: Unable to find css ".given_class" exceptions in random places it looks like driver does not wait for element appearance I'm using: Ruby 2.0 Cucumber 1.3.6 Capybara 2.1.0 Selenium-webdriver 2.35.1 PhantomJS 1.9.1 回答1: Capybara, particularly with PhantomJS will load a page really quickly, and perform checks for elements. As such, some elements may not have loaded and tests fail. By default capybara has a wait time of

Cucumber/Capybara: tests fail randomly under PhantomJS

爷,独闯天下 提交于 2020-01-04 09:56:02
问题 When I run cucumber scenarios under PhantomJS I get Capybara::ElementNotFound: Unable to find css ".given_class" exceptions in random places it looks like driver does not wait for element appearance I'm using: Ruby 2.0 Cucumber 1.3.6 Capybara 2.1.0 Selenium-webdriver 2.35.1 PhantomJS 1.9.1 回答1: Capybara, particularly with PhantomJS will load a page really quickly, and perform checks for elements. As such, some elements may not have loaded and tests fail. By default capybara has a wait time of

Selenium::WebDriver::Error::WebDriverError:

我怕爱的太早我们不能终老 提交于 2020-01-04 01:59:14
问题 I am trying to run some acceptance tests for javascript code. However, when I tried using Capybara with Selenium, I kept getting the following: >> Thin web server (v1.3.1 codename Triple Espresso) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:1234, CTRL+C to stop FF>> Thin web server (v1.3.1 codename Triple Espresso) >> Maximum connections set to 1024 >> Listening on 0.0.0.0:1234, CTRL+C to stop F Failures: 1) end to end acceptance test shows that x wins when it does Failure