Ruby 使用require打开helper_方法文件时收到以下错误[无效中断(SyntaxError)]
我对ruby是新手。我已经为我的watir脚本创建了一个helper方法文件。当我尝试运行脚本时,它会出现以下行:Ruby 使用require打开helper_方法文件时收到以下错误[无效中断(SyntaxError)],ruby,Ruby,我对ruby是新手。我已经为我的watir脚本创建了一个helper方法文件。当我尝试运行脚本时,它会出现以下行: require "C:/Sites/common/helper_methods" 并抛出此错误消息: C:/Sites/common/helper_methods.rb: C:/Sites/common/helper_methods.rb:1387: Invalid break (SyntaxError) 所以我不确定这个错误是什么意思 我一直在寻找答案,但找不到一个能帮助我理
require "C:/Sites/common/helper_methods"
并抛出此错误消息:
C:/Sites/common/helper_methods.rb: C:/Sites/common/helper_methods.rb:1387: Invalid break (SyntaxError)
所以我不确定这个错误是什么意思
我一直在寻找答案,但找不到一个能帮助我理解信息的答案
任何帮助都将不胜感激
乔
嗨,保罗
这是1387年以前的方法
该行:
C:/Sites/common/helper_methods.rb:
C:/Sites/common/helper_methods.rb:1387:
Invalid break (SyntaxError)
表示在helper_methods.rb…helper_methods.rb:1387的第1387行分析SyntaxError时出错
错误可能发生得更早,但解释器只能在第1387行注意到它。在第1387行周围张贴这些行可能有助于进一步诊断
1378是一个文件中的许多行。你可能想把这些方法分解成相关的大块,只包含你需要的部分。如果您可能需要5或6个文件,那么这样做也有助于找到错误,因为您知道错误位于您不需要的文件中。您还可以尝试注释helper_方法中的方法,直到找到触发问题的方法
#The following method will validate text at on the page not in a specific location
def text_validation(rt)
#Validate comment displays
if @browser.text.include? rt
#Response
response = "PASS!!! The following user comment was found [ #{rt} ]."
write_to_file(response)
else
#Response
response = "FAIL!!! The following user comment was NOT found [ #{rt} ]."
write_to_file(response)
end #End of Validate comment displays
end
C:/Sites/common/helper_methods.rb:
C:/Sites/common/helper_methods.rb:1387:
Invalid break (SyntaxError)