我有这种情况:
Scenario: If coming from savsale.com directly then the submenu items should open the right items.
Given the 'sales' page
When the user chooses 'women/accessories' from the navigation menu
而这一步:
When /^the user chooses '(.*?)\/(.*?)' from the navigation menu$/ do |menu,submenu|
begin
evaluate_script(%Q{console.debug('trying to show the menu:');})
command1 = "$('##{menu} ul').attr('style','display:block;visibility:visible');"
evaluate_script(%Q{console.debug("#{command1}");})
evaluate_script(command1)
evaluate_script(%Q{console.debug('first command done.');})
command2 = "$('##{menu}').addClass('sfHover');"
我也在使用 selenium 网络驱动程序:
Capybara::Selenium::Driver.new(app, :browser => :firefox)
javascript的执行没有达到这个代码:
evaluate_script(%Q{console.debug('first command done.');})
在 Firefox 控制台中显示如下:
$('#women ul').attr('style','display:block;visibility:visible');
但这不是:
first command done.
我认为它在execute_script(command1)处停止,然后它因超时异常而失败......:
When the user chooses 'women/accessories' from the navigation menu # features/step_definitions/steps.rb:193
Timeout::Error (Timeout::Error)
有人有好主意吗?