如何使用 Linux 实例化/运行 Ruby 程序(使用 Watir)?
场景:
我在 Win XP 计算机上映射了网络驱动器,然后双击 .bat 文件来执行此 Ruby 脚本。 .rb 和 .bat 文件驻留在该网络驱动器上。
批处理文件如下:
Z: cd Z:\ABC\StatusCheck\ "C:\Program Files\Ruby\Bin\ruby.exe" Z:\ABC\StatusCheck\rubyScript.rb 6
Ruby 文件如下:
require 'watir'
rec = File.open("list.txt", "r")
ie = Watir::IE.start()
***Other processing here***
我的问题:如何使用 Linux 实例化此批处理文件(当我在家时,因为我无法远程访问这台机器,我想从终端运行 .rb 文件)?
希望我说得有道理。我真的很感谢你们花时间!谢谢你!
Scenario :
I mapped a network drive on a Win XP machine and I double click a .bat file to execute this Ruby script. The .rb and .bat file reside on this networked drive.
The batch file is as follows :
Z:
cd Z:\ABC\StatusCheck\
"C:\Program Files\Ruby\Bin\ruby.exe" Z:\ABC\StatusCheck\rubyScript.rb 6
The Ruby file is as follows :
require 'watir'
rec = File.open("list.txt", "r")
ie = Watir::IE.start()
***Other processing here***
My Question : How do I instantiate this batch file using Linux (when I am at home cos I cannot remote into to this machine. I want to run the .rb file from the terminal)?
Hope I made sense. I really appreciate your time guys! Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 Linux 上运行它不需要任何批处理文件。您需要做的就是直接运行脚本
或者添加
到 rubyScript.rb 顶部并使其可执行,然后就可以直接运行。
然而,你更大的问题是你正在使用 watir 来自动化 IE,这显然不适用于 Linux,因此你需要更改它以使用其他浏览器。
You don't need any batch file to run this on linux. All you need to do is run the script directly with
or add
to the top of rubyScript.rb and make it executable, then you can run directly.
However, your bigger problem is that you are using watir to automate IE, which obviously won't work on Linux, so you'll need to change it to use another browser.