@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 类。为课程编写的所有内容都如上。当我运行脚本时,它没有抛出任何错误,也不会及时终止。
它是否试图下载所有带注释的依赖项?如果是这样,是否每次运行时都需要下载依赖项?还是一劳永逸?