| From | Sent On | Attachments |
|---|---|---|
| Bob Brown | Sep 3, 2011 1:09 am | |
| Paul Hammant | Sep 3, 2011 2:42 am | |
| Luke Daley | Sep 3, 2011 3:16 am | |
| Bob Brown | Sep 3, 2011 3:33 am | |
| Bob Brown | Sep 3, 2011 3:46 am | |
| Luke Daley | Sep 3, 2011 5:45 am | |
| Bob Brown | Sep 4, 2011 2:41 am | |
| Luke Daley | Sep 7, 2011 1:24 am | |
| Bob Brown | Sep 7, 2011 2:47 am |
| Subject: | [geb-user] Meta Refresh on a page causes infinite loop | |
|---|---|---|
| From: | Bob Brown (bo...@transentia.com.au) | |
| Date: | Sep 3, 2011 1:09:18 am | |
| List: | org.codehaus.geb.user | |
I have a small Geb script, as follows:
---
System.properties.with { p ->
p['geb.browser']='htmlunit'
p['org.apache.commons.logging.Log']='org.apache.commons.logging.impl.SimpleL og'
p['org.apache.commons.logging.simplelog.log.com.gargoylesoftware.htmlunit']= 'TRACE'
}
@Grapes([
@Grab("org.codehaus.geb:geb-core:0.6.0"),
@Grab("org.seleniumhq.selenium:selenium-htmlunit-driver:2.5.0")
])
import geb.*
Browser.drive {
go "file:html/frame_b.htm"
assert title == "Frame B"
}
---
The test file html/frame_b.htm is:
---
<html>
<head>
<title>Frame B</title>
<meta http-equiv="refresh" content="5">
</head>
<body style="background-color:#EBC79E">
<h3>Frame B</h3>
</body>
</html>
---
Execution is under Java 6/Groovy 1.8.1 as:
---
groovy -D-Dgroovy.grape.autoDownload=false -Dgroovy.grape.report.downloads=true Frame.geb
---
This script goes into an infinite loop such that the assert line is never reached.
The trace shows thusly:
---
.
[TRACE] JavaScriptExecutor - started finding earliestJob at 1315036884648
[TRACE] JavaScriptExecutor - stopped finding earliestJob at 1315036884648
[DEBUG] WebClient - Get page for window named '', using WebRequest[<url="file:ht
ml/frame_b.htm", GET, EncodingType[name=application/x-www-form-urlencoded], [],
{Accept=*/*}, null>]
[TRACE] JavaScriptExecutor - started finding earliestJob at 1315036884658
[TRACE] JavaScriptExecutor - stopped finding earliestJob at 1315036884658
[DEBUG] WebWindowImpl - setEnclosedPage: HtmlPage(file:html/frame_b.htm)@2489666
96
[DEBUG] WebWindowImpl - destroyChildren
[DEBUG] EncodingSniffer - Encoding found in Unicode Byte Order Mark: 'UTF-16LE'.
[TRACE] JavaScriptExecutor - started finding earliestJob at 1315036884668
.
---
As the refresh timer fires, the trace shows:
---
.
[TRACE] JavaScriptExecutor - started finding earliestJob at 1315036648422
[TRACE] JavaScriptExecutor - stopped finding earliestJob at 1315036648422
[DEBUG] WebClient - Get page for window named '', using WebRequest[<url="file:ht
ml/frame_b.htm", GET, EncodingType[name=application/x-www-form-urlencoded], [],
{Accept=*/*}, null>]
[DEBUG] WebWindowImpl - setEnclosedPage: HtmlPage(file:html/frame_b.htm)@1101985
688
[DEBUG] WebWindowImpl - destroyChildren
[TRACE] JavaScriptExecutor - started finding earliestJob at 1315036648432
[TRACE] JavaScriptExecutor - stopped finding earliestJob at 1315036648432
[DEBUG] EncodingSniffer - Encoding found in Unicode Byte Order Mark: 'UTF-16LE'.
[TRACE] JavaScriptExecutor - started finding earliestJob at 1315036648442
[TRACE] JavaScriptExecutor - stopped finding earliestJob at 1315036648442
[TRACE] JavaScriptExecutor - started finding earliestJob at 1315036648453
[TRACE] JavaScriptExecutor - stopped finding earliestJob at 1315036648453
.
---
Is this a FAQ or a bug? Couldn't find anything particularly related for either htmlunit or webdriver.
I found this:
http://groups.google.com/group/webdriver/browse_thread/thread/213dccadb0bb83 ed
.which says use waitFor for a particular element on the page.didn't seem to work for me. I tried adding:
waitFor { $("h3").present }
before the assert line.
Any suggestions gratefully received.
Cheers,
BOB
---
Bob Brown
Director, Transentia Pty. Ltd.
Training, consulting, development at the leading edge of technology.
73 Frasers Rd. Mobile: 0416-078-813
Ashgrove Email: bo...@transentia.com.au
Brisbane Web: www.transentia.com.au <http://www.transentia.com.au/>
Queensland 4060
Australia
NOTE: This email may NOT be taken to constitute an agreement to form a
"prior relationship" or to give "prior affirmative consent" for the
purposes of opt-in mass marketing.
---
"Electricity made us angels
and money made us fools,
but fear of future shackled us
to gods who ride the backs of mules."
-- Bill Nelson





