我想使用phantomJS进行一些网络测试,我遇到了GhostDriver(
https://github.com/detro/ghostdriver).我使用自述文件中的说明构建它,我可以在指定的端口上运行它,但我不知道如何从我的Java代码访问Web驱动程序.为了澄清,我在ruby中看到了这个例子:
caps = {
:browserName => "phantomjs",
:platform => "LINUX"
}
urlhub = "http://key:secret@hub.testingbot.com:4444/wd/hub"
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120
@webdriver = Selenium::WebDriver.for :remote, :url => urlhub, :desired_capabilities => caps, :http_client => client
@webdriver.navigate.to "http://www.google.com/"
puts @webdriver.title
@webdriver.save_screenshot("./screenshot.png")
@webdriver.quit
我只是不确定如何从java做同样的事情.