Hello,
How can I access an iframe within the result page?
The page contains a lot of Javascript that actually modifies the page and an
iframe is created. The result (as seen in Firebug) looks something like
this:
<html>
...
<form id="editform" enctype="multipart/form-data"
action="/mediawiki/index.php?title=Berlin&action=submit" method="post"
name="editform">
<input type="hidden" ...>
...
<iframe id="wpTextbox1___Frame" width="100%" scrolling="no" height="300"
frameborder="0" tabindex="1" src="..."> <html> ... </html>
</iframe>
</form>
...
</html>
I have no trouble to access the form and it's hidden fields there. This
works with:
def formcont = document.getElementById('editform')
However I don't know how to access the content of the iframe. I tried:
def frame1 =
step.context.currentResponse.getFrameByName('wpTextbox1___Frame').getEnclosedPage();
Error invoking script:
com.gargoylesoftware.htmlunit.ElementNotFoundException: elementName=[frame
or iframe] attributeName=[name] attributeValue=[wpTextbox1___Frame]
then:
final HtmlPage frame1 =
(HtmlPage)document.getFrameByName('wpTextbox1___Frame').getEnclosedPage();
Error invoking script:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup
failed, WebTest: 5: unable to resolve class HtmlPage @ line 5, column
32.WebTest: 5: unable to resolve class HtmlPage @ line 5, column 41. 2
errors
and:
def frame1 = document.getFrameByName('wpTextbox1___Frame').getEnclosedPage();
Error invoking script: groovy.lang.MissingMethodException: No signature of
method: com.gargoylesoftware.htmlunit.html.HtmlHtml.getFrameByName() is
applicable for argument types: (java.lang.String) values:
[wpTextbox1___Frame]
the first line is my try and then the error follows. The script parts are
in a xml encapsulated by:
<scriptStep description="add some text" language="groovy">
</scriptStep>
Any help on how I can access the iframe contents will be appreciated.
BTW: testcases are for the FCKeditor within the Mediawiki. The content that
is edited is once in a normal textarea. What is really being modified in a
edit session is the content of a second iframe within the first one, which
contains the whole editor window. Therefore I need to modify the content of
the second iframe within the tests (simulating that the user would type
something).
Thank you.
Best regards,
Stephan Robotta
Professional Services
ontoprise GmbH - know how to use Know-how
- - -
An der RaumFabrik 29; 76227 Karlsruhe
E-Mail: [email protected] ; Web: www.ontoprise.de
Sitz der Gesellschaft: Karlsruhe, Amtsgericht Mannheim, HRB 109540
Geschäftsführer: Prof. Dr. Jürgen Angele, Dipl. Wi.-Ing. Hans-Peter Schnurr
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest