在同一浏览器窗口上从不同的 ruby 脚本触发 FireWatir 操作
我正在编写一个使用 FireWatir 执行一系列不同操作的应用程序。问题是我想从许多单独的 ruby 文件触发这些操作。
例如,一个 ruby 脚本将启动一个新的 FireFox 浏览器实例,而另一个完全不同的脚本将让该实例转到特定网站,而另一个脚本将登录 gmail。
我希望所有这些脚本都能影响同一个浏览器窗口。这样我就可以让一个脚本带我到一个特定的网站,并等待另一个脚本被触发来执行其他操作。
请告诉我这是可能的。
I am writing an application that uses FireWatir to do a bunch of different actions. The problem is that I want to trigger these actions from many separate ruby files.
So for example, one ruby script will launch a new FireFox browser instance, than a totally different script will have that instance goto a specific website, and another will log into gmail.
I want all of these scripts to affect the same browser window. That way I can have one script take me to a specific website, and wait for another script to be triggered to do something else.
Please tell me that this is possible.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
查德,
我认为这是可能的。我不确定这是否必要或有效,但我知道这是可能的。关键是确保您附加到正确的浏览器实例。如果你只有一个,那可能会简单得多。
如果您确定了要使用这些多个脚本尝试解决的问题,那么也许一位或多位经验丰富的框架设计人员可以为您指出该问题的现有解决方案。已经存在一些非常棒的解决方案。归根结底,我们面临着同样的问题。
祝你好运,
戴夫
Chad,
I think that is possible. I am not sure that it's necessary or efficient, but I know that it's possible. The key is to make sure that you attach to the right browser instance. If you will only have one, that could be much simpler.
If you identify the problem that you are trying to solve with these multiple scripts then maybe one or more of the experienced framework designers can point you to existing solutions to the problem. There are some pretty awesome solutions that exist already. At the end of the day, we face the same issues.
Good luck,
Dave
我最终通过使用套接字解决了这个问题。有一个 ruby 脚本充当服务器,等待来自另一组 ruby 脚本的请求,这些脚本可以随时触发。
I ended up getting around this issue by using socketing. Had a ruby script acting as the server that was waiting for requests from another group of ruby scripts that could be triggered whenever.