@Grapes([
@Grab("org.codehaus.geb:geb-core:0.7.2"),
@Grab("org.seleniumhq.selenium:selenium-firefox-driver:2.15.0"),
@Grab("org.seleniumhq.selenium:selenium-support:2.15.0")
])
import geb.Browser
Browser.drive {
// Load the page
go "http://www.whu.edu.cn"
// $("a") returns all hyperlinks on the page, similar to jQuery
$("a").each { a ->
// Display the required link properties and attributes
println """
The link to '${a.@href}' with text '${a.text()}' is at location (${a.x}, ${a.y}),
with a height of ${a.height}px and a width of ${a.width}px.
"""
}
}
Eclipse で最初の Groovy プロジェクトを作成し、プロジェクト内に最初の Groovy クラスを作成しました。クラス用に書かれたものはすべて上記のとおりです。スクリプトを実行すると、エラーは発生せず、時間内に終了しませんでした。
注釈付きの依存関係をすべてダウンロードしようとしていましたか? その場合、実行するたびに依存関係をダウンロードする必要がありますか? それとも一度限りですか?