我正在尝试在2帧内做一些事情,但每次尝试在帧之间切换时都会出现错误。例如:#encoding:utf-8require"capybara/dsl"Capybara.run_server=falseCapybara.current_driver=:seleniumCapybara.app_host='https://hb.posted.co.rs/posted'classAccountincludeCapybara::DSLdefcheck_balancevisit('/')page.driver.browser.switch_to.frame'main'fill_in'korisnik
Controller中的内容如下:respond_todo|format|format.csv{send_dataas_csv,type:'text/csv'}end在规范中:click_link'DownloadCSV'page.driver.browser.switch_to.alert.acceptexpect(page).tohave_contentcsv_data但这行不通:Failure/Error:page.driver.browser.switch_to.alert.acceptSelenium::WebDriver::Error::NoAlertPresentErro
GivenIhavearailsappAndI'musingcucumberAndI'musingcapybaraAndIhaveanactionthatresultsinaredirect_to"http://some.other.domain.com/some_path"WhenItestthisactionThenthein-appportionofthetestworksfineButIseethiserror:Noroutematches"/some_path"with{:method=>:get}(ActionController::RoutingError)所以capyb
对于一个看似简单的问题,我已经思考了很长时间,但似乎无法在Google上找到任何内容。我有这个按钮,我需要点击它没有id但包含一个类CASESTUDIES(2)我试过使用click_on,我现在知道它只适用于链接和按钮,所以当然不会起作用。这是我目前所拥有的:When(/^Ifiltertheresultstoonlyseecasestudies$/)doclick_on('filter-case-studies')end我也尝试过page.find('filter-case-studies').click,这也行不通。page.find(:class,'filter-case-stu
我需要检查页面上特定类型的选择器中是否存在某些内容。例如,假设我有以下HTML:HEADLINEONEHEADLINETWO我知道如何只选择页面上的第一个:find('h2').shouldhave_content('HeadlineTwo')#have_contentisalsocaseinsensitive我如何检查页面上所有h2中是否存在内容? 最佳答案 显然您可以选择具有给定文本的元素:page.shouldhave_selector('h2',text:/#{headline}/i)注意:我使用正则表达式使文本搜索不区分大
我正在使用capybara-webkit来测试与第三方网站的集成(我需要javascript)。我想使用vcr来记录在集成测试期间发出的请求,但capybara-webkit不通过nethttp,因此vcr无法记录它们。我将如何着手编写一个允许我记录请求的vcr适配器? 最佳答案 不幸的是,VCR与capybara-webkit非常不兼容。事实上,capybarawebkit正在使用webkit,它是在c中。作为VCR基础的Webmock和Fakeweb只能用于Rubyweb请求。让两者协同工作可能是一项艰巨的任务。我用两种方法解决
我正在使用capybara对我的Rails3应用程序进行集成测试。当我将:js=>true添加到一个场景时,我的测试使用selenium,但是当我更改为使用js的webkit驱动程序时,我得到如下错误:capybara::Driver::Webkit::WebkitInvalidResponseError:无法加载URL:http://www.example.dev:7171/user_sessions我的添加是一个多域应用程序,所以在我的spec_helper中我设置了端口:capybara.server_port=7171在后台block中,我这样设置app_host:Capyba
以下按预期工作:within('h2',text:'foo')doshouldhave_content'bar'end我正在尝试使用find(:xpath,'..')在父元素中进行检查找到元素后,如何应用.find(:xpath,'..'),然后检查that中的内容强>元素? 最佳答案 当您在within中使用XPath定位器时,它应该以开头。(如果它不是以开头。搜索不会完成在.myclass但在整个文档中)。例如:within('.myclass')dofind(:xpath,'./div')end或:find('.myclass
我有这样的规范:it'containsDeletelink'doexpect(page).tohave_link('Delete',admin_disease_path(disease))end当我运行规范时,它会在控制台中返回警告:UnusedparameterspassedtoCapybara::Queries::SelectorQuery:["/admin/diseases/913"]我该如何解决这个问题? 最佳答案 expect(page).tohave_link('Delete',href:admin_disease_pa
关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭8年前。Improvethisquestion前几天,我向我公司的一位测试人员展示了我用Cucumber编写的一些测试(2个功能,5个场景)。然后他问了我无法回答的问题:Howisthisbetterthanseleniumoranyotherfunctionalitytestrecordingtool?我知道Cucumber是一种不同的技术,它处于不同的测试级别,但我不明白为什么我要费心编写和维护Cucumber/Capybara测