我完全意识到这是错误的做法,但我对 ruby 并不是很熟悉。我很确定最好的选择是用例?还是一个循环?
def addInfoToStory(idOfStory, storyTitle, storyPriority, storyEST, storySupporter, storyBugzilla, storyStatus, storyOutcome, storyCustomer, storyNotes)
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>1).div.double_click
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>1).div(:class => "formLib1").text_field(:id, 'input').set"#{storyTitle}"
@browser.send_keys :tab
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>2).div.double_click
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>2).div(:class => "formLib1").text_field(:id, 'input').set"#{storyPriority}"
@browser.send_keys :tab
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>3).div.double_click
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>3).div(:class => "formLib1").text_field(:id, 'input').set"#{storyEST}"
@browser.send_keys :tab
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>4).div.double_click
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>4).div(:class => "formLib1").text_field(:id, 'input').set"#{storySupporter}"
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>5).div.double_click
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>5).div(:class => "formLib1").text_field(:id, 'input').set"#{storyBugzilla}"
@browser.send_keys :tab
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>6).div.double_click
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>6).div(:class => "formLib1").text_field(:id, 'input').set"#{storyStatus}"
@browser.send_keys :tab
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>7).div.double_click
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>7).div(:class => "formLib1").text_field(:id, 'input').set"#{storyOutcome}"
@browser.send_keys :tab
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>8).div.double_click
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>8).div(:class => "formLib1").text_field(:id, 'input').set"#{storyCustomer}"
@browser.send_keys :tab
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>9).div.double_click
@browser.div(:id => "#{idOfStory}"+"_firstCol").div(:class => "tDetEntry", :index =>9).div(:class => "formLib1").text_field(:id, 'input').set"#{storyNotes}"
@browser.send_keys :tab
end
关于我可以完成这个填写表格过程的最有效方式的任何建议?