所以我试图提交一个简单的表单,其中有一个与此类似的文本区域
"Lots of stuff that doesn't matter
a couple of lines later
agent => A5656,,5665"
我正在尝试做的是取消与代理的联系。顺便说一句,这个文件中有很多“代理”行,这并不重要。无论如何,这是我的代码:
new_agent = @elastix.get https://#{@elastix_ip}/index.phpmenu=file_editor&action=edit&file=agent.conf
new_agent_form = new_agent.forms.first
settings = new_agent_form['content']
new_agent_form['content'] = settings.gsub(/agent => #{options[:ext]},,#{options[:UserID]}/,'')
new_agent_form.encoding = "utf-8"
@elastix.submit(new_agent_form,new_agent_form.button_with(:name => "Guardar"))
没有错误被抛出,如果我
"raise new_agent_form.content.inspect"
在提交之前,它显示文本区域不包含我想要的条目。出于某种原因,这要么不起作用,要么我错过了一些东西。任何帮助,将不胜感激。
最佳答案
问题已解决。这与有许多名称=名称的 div 标签有关。他们为什么要这样做,我不知道。但是您可以放心, Mechanize 可以正常工作。
关于ruby - Mechanize 和提交文本区域的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12117619/