问题描述
我试过了:
$('body') << Keys.chord(Keys.CONTROL,"w") -
driver.close()
driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL +"w")
这是测试代码:
def "scrape"() {
when:
ScrapeTestPage page = to ScrapeTestPage
then:
$("input",name: "search").value("test")
$("button",type: "submit").click()
$('td a',0).click() //this opens a new tab
DetailsPage page1 = to DetailsPage
println "test"
//Now I'd like to close that tab without closing the first one
}
我尝试将新选项卡包装在 withNewWindow 中,但它引发错误:
withNewWindow({$('td a',0).click()}){} | org.openqa.selenium.invalidargumentexception:预期“句柄”为字符串,得到 [object Undefined] 未定义
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)