<html><head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>Window Open Test</title>
<script type="text/javascript"> function open_blank(){ var w = window.open("about:blank", "_blank", "width=800,height=500,status=0,toolbar=0"); w.document.write("<html><head></head><title>New Window</title><body><div id='divel'>div text</body></html>"); w.document.close(); w.focus();}
</script>
</head><body> <button id="newwindow" onclick="open_blank()">window open blank</button></body></html>class SimplePage extends Page {
static url = 'file:///home/ykalemi/geb.html'
static at = { title == "Window Open Test" }
String getDivText() {
return browser.withNewWindow( {$('#newwindow').click()} ) {
return $('div', id: 'divel').text()
}
}
}
class ModuledPage extends Page {
static url = 'http://localhost/geb.html'
static at = { title == "Window Open Test" }
static content = {
simpleWindowModule {module SimpleModule}
smartWindowModule {module SmartModule}
}
}
class SimpleModule extends Module {
String getDivText() {
return browser.withNewWindow( {$('#newwindow').click()} ) {
return $('div', id: 'divel').text()
}
}
}
class SmartModule extends Module {
String getDivText() {
return browser.withNewWindow( {$('#newwindow').click()} ) {
return browser.navigator.find('div', id: 'divel').text()
}
}
}
class ModuleSpec extends GebReportingSpec {
// pass
def 'PageInteraction'() {
when:
to SimplePage
then:
getDivText() == 'text'
}
// fails with NoSuchElementException: Web element reference not seen before: 4d4c610f-1366-4bc1-ad34-15f6326e336d
def 'SimpleModuleInteraction'() {
when:
to ModuledPage
then:
simpleWindowModule.getDivText() == 'text'
}
// pass
def 'SmartModuleInteraction'() {
when:
to ModuledPage
then:
smartWindowModule.getDivText() == 'text'
}
}
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/4e08e721-e895-4a4d-b2a3-73fe22e29c07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
return browser.withNewWindow({$('#newwindow').click()}, page: NewWindowPage) {
return txtElement
}
simpleWindowModule.getDivText() == 'text'| || groovy.lang.MissingPropertyException: Unable to resolve txtElement as content for ModuledPage -> simpleWindowModule: SimpleModule, or as a property on its Navigator context. Is txtElement a class you forgot to import?ModuledPage -> simpleWindowModule: SimpleModule
String getDivText() {
return browser.withNewWindow({$('#newwindow').click()}, page: NewWindowPage) {
def page = browser.getPage()
return page.txtElement
}
}
--
You received this message because you are subscribed to the Google Groups "Geb User Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geb-user+u...@googlegroups.com.
To post to this group, send email to geb-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/bd52bac3-5a29-4a1a-be9f-f880cdd50bbe%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/geb-user/55c5fef5-0ac9-4f45-9d40-b9677c7f03a9%40googlegroups.com.