我正在测试的网站提交了一个表单,一旦提交了表单,就会显示一个简单的模式窗口,通过关闭按钮感谢用户。由于某种原因,我找不到单击该关闭按钮的方法。
这是模态窗口的代码:
<div id="simplemodal-container" class="simplemodal-container" style="position: fixed; background-color: rgb(255, 255, 255); border: 3px solid rgb(102, 102, 102); padding: 30px; width: 380px; height: 270px; z-index: 1002; left: 409px; top: 63.5px;">
<div tabindex="-1" class="simplemodal-wrap" style="height: 100%; outline: 0px; width: 100%; overflow: visible;">
<div id="leadconfirm" class="overlaycontent simplemodal-data" style="">
<span class="popupheader">Talk to a</span>
<div class="indent">
<p class="bold">Thank you! You'll be hearing from us very soon.</p>
</div>
<div class="buttonRow">
<input id="registrationclose" class="simplemodal-close btn submitBut" type="submit" value="Close" name="close">
</div>
我已经尝试了以下步骤定义,这些定义是我之前尝试过的。
When /^I click on the xpath "([^\"]*)" button$/ do
find('button', :text => 'close')
#within("simplemodal-container") { click_on button_name }
#find(:xpath,".//*[@id='registrationclose']").click_on button_id
# page.driver.browser.switch_to.alert.accept
end
When /^I click on the "([^"]*)" button$/ do |button_value|
click_button button_value
end