【发布时间】:2012-12-16 19:52:31
【问题描述】:
我想使用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 中做同样的事情。
【问题讨论】:
标签: java selenium-webdriver webdriver phantomjs ghostdriver