【发布时间】:2019-02-12 05:03:17
【问题描述】:
我有一个 .properties 文件如下:
user:abcd
pwd:xyz
system:test
接下来,我有一个带有 Watir 的 ruby 脚本,用于实现浏览器自动化。在这个脚本中,我有类似
的语句browser.text_field(:id => 'identifierId').set "#{user}:variable to be replaced by its value from .properties file".
同样,“pwd”和“system”也需要替换其他值。
我根据以下帖子尝试了解决方案: Replace properties in one file from those in another in Ruby
但是,“set”命令将任何已作为参数的内容设置为它,而不是用它的值替换变量。
请帮忙。
【问题讨论】:
-
不太清楚您要做什么。你能举例说明你想要发生的事情吗?只是您想更改文件中的一些关键值吗?