Capybara - Div 在使用 Selenium 而非 poltergeist 时发现模态
Capybara - Div in modal found when using Selenium but not poltergeist
我们有一个站点,当单击 link 时会出现一个模式
在模式前点击 $6/mo
模态后
我正在尝试通过检查 "Estimate My Payment" 是否存在来确保模态已启动
<div class="modal fade modal-payment-options"
id="mortgagePaymentModal" tabindex="-1" role="dialog"
aria-labelledby="mortgageModalLabel" aria-hidden="true"> <div
class="modal-dialog modal-ad-lb"> <div class="modal-content"> <div
class="modal-header"> <button type="button" class="close"
data-dismiss="modal" aria-label="Close"
id="estimate-modal-close-button"> <h2 id="mortgageModalLabel"
class="modal-title">Estimate My Payment</h2>
正在使用
步骤 "Mortgage Loan Type' to 15 year Fixed Validate Remember Settings" 执行
Given 'I am a New User on a For Sale portait Tablet LDP and open payment modal' do
ResponsiveHelpers::resize_window_to_tablet_landscape
visit '/realestateandhomes-detail/1049-E-Qa-Test-Pl_Binder_CA_00001_M10182-29255'
click_link('mortgagePaymentPrice')
wait_for_ajax
**within('div.modal-content') {expect(page).to have_content('Estimate My Payment')}**
end
这在 Selenium 中工作正常 运行,但是当我将它切换到 poltergeist 时它总是失败,因为它找不到模态内容
Failure/Error: within('div.modal-content') {expect(page).to have_content('Estimate My Payment')}
Capybara::ElementNotFound:
Unable to find css "div.modal-content"
有什么建议吗,也许是语法问题?
您的应用是否使用 Bootstrap?我今天刚遇到类似的问题,我怀疑 Bootstrap 模态动画可能导致了这个问题...这位好心的人在这里解释了它:
http://blog.crowdint.com/2013/09/20/poltergeist-and-bootstrap-modals.html
我们有一个站点,当单击 link 时会出现一个模式
在模式前点击 $6/mo
模态后
我正在尝试通过检查 "Estimate My Payment" 是否存在来确保模态已启动
<div class="modal fade modal-payment-options"
id="mortgagePaymentModal" tabindex="-1" role="dialog"
aria-labelledby="mortgageModalLabel" aria-hidden="true"> <div
class="modal-dialog modal-ad-lb"> <div class="modal-content"> <div
class="modal-header"> <button type="button" class="close"
data-dismiss="modal" aria-label="Close"
id="estimate-modal-close-button"> <h2 id="mortgageModalLabel"
class="modal-title">Estimate My Payment</h2>
正在使用 步骤 "Mortgage Loan Type' to 15 year Fixed Validate Remember Settings" 执行
Given 'I am a New User on a For Sale portait Tablet LDP and open payment modal' do
ResponsiveHelpers::resize_window_to_tablet_landscape
visit '/realestateandhomes-detail/1049-E-Qa-Test-Pl_Binder_CA_00001_M10182-29255'
click_link('mortgagePaymentPrice')
wait_for_ajax
**within('div.modal-content') {expect(page).to have_content('Estimate My Payment')}**
end
这在 Selenium 中工作正常 运行,但是当我将它切换到 poltergeist 时它总是失败,因为它找不到模态内容
Failure/Error: within('div.modal-content') {expect(page).to have_content('Estimate My Payment')}
Capybara::ElementNotFound:
Unable to find css "div.modal-content"
有什么建议吗,也许是语法问题?
您的应用是否使用 Bootstrap?我今天刚遇到类似的问题,我怀疑 Bootstrap 模态动画可能导致了这个问题...这位好心的人在这里解释了它:
http://blog.crowdint.com/2013/09/20/poltergeist-and-bootstrap-modals.html