Scenario: Testing with prompt popups
Given I am on the frames page
When I popup the prompt and enter "Jared Gatorboy"
SyntaxError: missing ; before statement (Selenium::WebDriver::Error::JavascriptError)
./features/support/pages/frames_page.rb:35:in `block in prompt_value'
./features/support/pages/frames_page.rb:34:in `prompt_value'
./features/step_definitions/web01_steps.rb:35:in `block (2 levels) in <top (required)>'
./features/step_definitions/web01_steps.rb:34:in `/^I popup the prompt and enter "(.*?)"$/'
features/web01.feature:20:in `When I popup the prompt and enter "Jared Gatorboy"'
Then the message from the prompt should read "enter your name"
And the default value from the prompt should be "John Doe"./features/support/pages/frames_page.rb
def prompt_value(value)
in_frame(:id => 'frame_3') do |frame|
@prompt_response = prompt(value, frame) do
button_element(:id => 'prompt_button', :frame => frame).click
end
end
@prompt_response
end./features/step_definitions/web01_steps.rb
When(/^I popup the prompt and enter "(.*?)"$/) do |value_to_enter|
on_page(FramesPage) do |page|
@prompt_response = page.prompt_value(value_to_enter)
end
endApp URL
发布于 2013-03-28 01:00:26
你能告诉我你使用的是什么浏览器和驱动程序吗?在页面对象测试套件中,有一个使用此页面的测试。以下是步骤定义
When /^I trigger a prompt within a frame$/ do
@page.in_frame(:id => 'frame_3') do |frame|
@msg = @page.prompt("Cheezy", frame) do
@page.button_element(:id => 'prompt_button', :frame => frame).click
end
end
end它看起来与您的步骤中的逻辑相同,并且测试使用selenium-webdriver和watir-webdriver作为驱动程序在最新的firefox上工作。
https://stackoverflow.com/questions/15536645
复制相似问题