我用 Ruby 编写了一个程序,它经常检查网页,并在找到数据时执行一些操作。我是使用 Watir-Webdriver 编写的。
我还希望这个程序作为“守护进程”运行。我在使用 Watir-Webdriver 时遇到的问题是,如果每次都弹出浏览器,我就无法运行它。
I actually need to write this in Java? Which is best Java package thats similar in functionality to Watir-Webdriver?
Is there any way to implement this in Java - to check a webpage and do specific actions - all in the background?
Also, I would like this to be cross-platform.
提前感谢您的帮助
最佳答案
您正在寻找Selenium WebDriver 。它可以用 Java 和许多其他语言编写。
是的。 Webdriver可以运行不同类型的浏览器。您正在寻找我们所说的 headless 司机。最受欢迎的 headless 驱动程序是 HtmlUnitDriver或GhostDriver 。我个人更喜欢 GhostDriver,因为它运行更现代版本的 Javascript。
所有 Java 代码都可以在不同平台上运行,因此这应该不是问题。
关于Java编程: Something like Watir-Webdriver running in background,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23002599/