Support Requests item #1849169, was opened at 2007-12-12 07:51
Message generated for change (Comment added) made by atop85
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=497983&aid=1849169&group_id=61302
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: atop85 (atop85)
Assigned to: Julien HENRY (henryju)
Summary: Can't find a link - although its there
Initial Comment:
Hello everybody,
I have a problem with testing a website. I just wanted to assure that links
are there and I can click on them - but it fails. For information I'm using
JWebUnit 1.4.1.
Here is the code:
<table>
..
<TABLE width="100%" border="0" cellpadding="0" cellspacing="0">
<TR>
<TD class="navigation1Aktiv">
TextOne</TD>
</TR>
<TR>
<TD class="navigation2Aktiv">
TextTwo</TD>
</TR>
<TR>
<TD class="navigation2" id="unav1"
onMouseOver="P7_swapClass(1,'unav1','navigation2Over',
'navigation2Over','td')"
onMouseOut="P7_swapClass(1,'unav1','navigation2',
'navigation2','td')"
onClick="window.location.href='dispatch.do;
jsessionid=******************:-1
?ref=****_***&rai=0&bt_TXN=do'">
<NOSCRIPT>
<A href="dispatch.do;
jsessionid=*******************:-1?ref=1500_****&+
rai=0&bt_TXN=do" class="nav2"
onfocus="if(this.blur)this.blur()">LinkName</A>
</NOSCRIPT>
<script language="JavaScript"> document.write("<a
class='nav2'>LinkName</a>")</script></TD>
</TR>
----------------------------------------------------
And here is the JWebUnit-Code:
package ******;
import net.sourceforge.jwebunit.junit.WebTestCase;
import org.junit.After;
import org.junit.Before;
public class CheckContentMainPage extends WebTestCase{
public CheckContentMainPage(String name){
super(name);
}
public void main(String[] args){
junit.textui.TestRunner.run(CheckContentMainPage.class);
}
@Before
public void setUp() throws Exception{
super.setUp();
getTestContext().setBaseUrl("http://*****/****/");
}
@After
public void tearDown() throws Exception {
}
public void testKreditkartenOnlineLinks(){
setScriptingEnabled(true);
beginAt("/");
assertFormPresent("***");
setWorkingForm("****");
assertSubmitButtonPresent("logon");
submit("logon");
gotoWindow(1); // everything works until this point
assertLinkPresentWithText("LinkName");
// Now I'll get an AssertionFailedError
}
}
----------------------------------------------------
I hope you can help me, because I've tried some things but nothing worked.
Don't know what to do now. ;)
Bye Atop85
----------------------------------------------------------------------
>Comment By: atop85 (atop85)
Date: 2007-12-13 08:52
Message:
Logged In: YES
user_id=1957383
Originator: YES
Thanks for the explanation of the problem.
What do you understand under a small unit test that reproduce the
problem?
Do you want me to change the JUnit-Code or to pack the
Web-Application-Code?
I could only try the first point - change the JUnit-Code - because I'm not
the developer of the page I'm testing.
Atop85
----------------------------------------------------------------------
Comment By: Julien HENRY (henryju)
Date: 2007-12-12 14:07
Message:
Logged In: YES
user_id=1235926
Originator: NO
Your HTML seems to support both browser with and without JavaScript
support.
With JavaScript enabled what is between <NOSCRIPT> tag is NOT parsed and
document.write is executed.
With JavaScript disabled what is between <NOSCRIPT> tag is parsed and
document.write is NOT executed.
I dont't kwnow why it doesn't work in the first case. HtmlUnit (the
underlying testing engine used by JWebUnit) is known to have a bug with
document.write in certain condition. But in this case, it should work.
setScriptingEnabled(false) is only a workaround because you will not be
able to fully test your site with JavaScript disabled. Could you try to
make a small unit test that reproduce the problem?
++
Julien
----------------------------------------------------------------------
Comment By: atop85 (atop85)
Date: 2007-12-12 10:51
Message:
Logged In: YES
user_id=1957383
Originator: YES
Hey,
thank you very much!! It works when I set setScriptingEnabled(false).
Could you please explain me why I had to this to understand the problem?
Because I thought i have to set it true, because JavaScript is used in the
code. That would be nice for a "better" understanding of the problem and to
avoid such problems in the future. ;)
Bye Atop85
----------------------------------------------------------------------
Comment By: Julien HENRY (henryju)
Date: 2007-12-12 10:42
Message:
Logged In: YES
user_id=1235926
Originator: NO
You are using a NOSCRIPT tag, so it is
<script language="JavaScript"> document.write("<a
class='nav2'>LinkNameOne</a>")</script>
that could make a problem.
Did you tried with setScriptingEnabled(false)?
Could you please try to reproduce the problem with the smallest possible
HTML page?
Julien
----------------------------------------------------------------------
Comment By: atop85 (atop85)
Date: 2007-12-12 10:20
Message:
Logged In: YES
user_id=1957383
Originator: YES
Hey,
I made a fault...the link "LinkName" is the same as "LinkNameOne" in my
code. I had to make the names anomynous. But in reality they match
eachother.
Any other suggestions why it does not work?
Atop85
----------------------------------------------------------------------
Comment By: Julien HENRY (henryju)
Date: 2007-12-12 10:16
Message:
Logged In: YES
user_id=1235926
Originator: NO
In the sources, I only see 2 link with text: "LinkNameOne" and
"LinkNameTwo".
assertLinkPresentWithText("LinkName"); will check for a link with the
exact name "LinkName" and that's why it fails.
----------------------------------------------------------------------
Comment By: atop85 (atop85)
Date: 2007-12-12 08:40
Message:
Logged In: YES
user_id=1957383
Originator: YES
Hey,
thank you for your fast answers.
Here is the code of the second window:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>
********
</TITLE>
<META http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<LINK rel="stylesheet" href="css/*****.css" type="text/css">
<SCRIPT src="js/****/standard.js"></SCRIPT>
<script language="JavaScript" type="text/JavaScript">
<!--
FUNCTION MM_reloadPage(init) { //reloads the window if Nav4 resized
IF (init==TRUE) WITH (navigator) {IF
((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight;
onresize=MM_reloadPage; }}
ELSE IF (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH)
location.reload();
}
MM_reloadPage(TRUE);
//-->
</script>
</HEAD>
<BODY>
<DIV align="center" class="pageLayer">
<TABLE width="953" height="100%" cellspacing="0" cellpadding="0">
<TR>
<TD colspan="3" class="top" >
<DIV align="right">
<TABLE border="0" cellspacing="0" cellpadding="0">
<TR>
<TD class="themen">
<A
href="dispatch.do?bt_EXTURL=do&exturl=html/***/help.html&ref=***"
class="thema" target="_blank"
onfocus="if(this.blur)this.blur()">Hilfe</A></TD>
<TD class="themen">
|</TD>
<TD class="themen">
<A
href="dispatch.do?bt_EXTURL=do&exturl=html/****/contact.html&ref=1500_***"
class="thema" target="_blank"
onfocus="if(this.blur)this.blur()">Kontakt</A></TD>
<TD class="themen">
|</TD>
<TD class="themen">
<A
href="dispatch.do?bt_EXTURL=do&exturl=http://******" class="thema"
target="_blank" onfocus="if(this.blur)this.blur()">*****</A></TD>
<TD class="themen">
|</TD>
<TD class="themen">
<A
href="dispatch.do?bt_EXTURL=do&exturl=https://*********" class="thema"
target="_blank" onfocus="if(this.blur)this.blur()">AGB</A></TD>
<TD class="themen">
|</TD>
<TD class="themen">
<A
href="dispatch.do?bt_EXTURL=do&exturl=http://*******" class="thema"
target="_blank" onfocus="if(this.blur)this.blur()">Impressum</A></TD>
<TD class="themen">
|</TD>
<TD class="themen">
<A
href="dispatch.do;jsessionid=****:-1?bt_LOGOUT=do&ref=1500_***&rai=0"
class="thema" onfocus="if(this.blur)this.blur()">Beenden</A></TD>
</TR>
</TABLE>
</DIV></TD>
</TR>
<TR>
<TD class="navColumn">
<TABLE width="100%" border="0" cellpadding="0"
cellspacing="0">
<TR>
<TD class="navigation1Aktiv">
TextOne</TD>
</TR>
<TR>
<TD class="navigation2Aktiv">
TextTwo</TD>
</TR>
<TR>
<TD class="navigation2" id="unav1"
onMouseOver="P7_swapClass(1,'unav1','navigation2Over','navigation2Over','td')"
onMouseOut="P7_swapClass(1,'unav1','navigation2','navigation2','td')"
onClick="window.location.href='dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?ref=1500_***&rai=0&bt_TXN=do'">
<NOSCRIPT>
<A
href="dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?ref=1500_****&rai=0&bt_TXN=do"
class="nav2" onfocus="if(this.blur)this.blur()">LinkNameOne</A> // Here
is the Problem
</NOSCRIPT>
<script language="JavaScript"> document.write("<a
class='nav2'>LinkNameOne</a>")</script></TD>
</TR>
<TR>
<TD class="navigation2" id="unav2"
onMouseOver="P7_swapClass(1,'unav2','navigation2Over','navigation2Over','td')"
onMouseOut="P7_swapClass(1,'unav2','navigation2','navigation2','td')"
onClick="window.location.href='dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?ref=1500_****&rai=0&bt_STMTLIST=do'">
<NOSCRIPT>
<A
href="dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?ref=1500_****&rai=0&bt_STMTLIST=do"
class="nav2" onfocus="if(this.blur)this.blur()">LinkNameTwo</A>
</NOSCRIPT>
<script language="JavaScript"> document.write("<a
class='nav2'>LinkNameTwo</a>")</script></TD>
</TR>
<TR>
<TD>
<A href="dispatch.do?bt_EXTURL=do&exturl=http://*******"
target="_blank">
<IMG src="https://****" border="0"></A></TD>
</TR>
</TABLE>
</TD>
<TD class="contentColumn">
<DIV align="center">
<TABLE width="633" border="0" cellspacing="0"
cellpadding="0">
<TR>
<TD class="tabBreadcrumb">
Home >>
<A
href="dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?bt_ACCBAL=do&ref=1500_****&rai=0"
class="breadcrumb" onfocus="if(this.blur)this.blur()">TextOne</A>
>> ***</TD>
</TR>
</TABLE>
<TABLE width="633" border="0" cellspacing="0"
cellpadding="0">
<TR>
<TD class="name">
****</TD>
</TR>
<TR>
<TD class="tabName">
<TABLE width="100%" border="0" cellspacing="2"
cellpadding="0">
<TR>
<TD width="35%" class="tabtext">
***</TD>
<TD class="tabdata">
<A
href="dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?ref=1500_****&rai=0&bt_TXN=do"
id="rai-0">****</A></TD>
</TR>
<TR>
<TD width="35%" class="tabtext">
****</TD>
<TD class="tabdata">
****</TD>
</TR>
<TR>
<TD width="35%" class="tabtext">
***</TD>
<TD class="tabdata">
****</TD>
</TR>
<TR>
<TD width="35%" class="tabtext">
*****</TD>
<TD class="tabdata">
****</TD>
</TR>
<TR>
<TD width="35%" class="tabtext">
****</TD>
<TD class="tabdata">
****</TD>
</TR>
<TR>
<TD width="35%" class="tabtext">
****</TD>
<TD class="tabdata">
****</TD>
</TR>
<TR>
<TD class="tabtext">
</TD>
<TD class="tabdata">
<A
href="dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?bt_ACTMD%5ESHOW=do&ref=1500_****&rai=0">******</A></TD>
</TR>
</TABLE></TD>
</TABLE>
<BR>
</DIV></TD>
<TD class="satColumn">
<A href="dispatch.do?bt_EXTURL=do&exturl=http://*****"
target="_blank">
<IMG src="https://****" border="0"></A></TD>
</TR>
<TR>
<TD colspan="3" class="foot">
© ******</TD>
</TR>
</TABLE>
</DIV>
</BODY>
</HTML>
--------------
Bye Atop85
----------------------------------------------------------------------
Comment By: Julien HENRY (henryju)
Date: 2007-12-12 08:25
Message:
Logged In: YES
user_id=1235926
Originator: NO
OK,
Now please send me the result of getPageSource() after gotoWindow(1);
++
Julien
----------------------------------------------------------------------
Comment By: atop85 (atop85)
Date: 2007-12-12 08:20
Message:
Logged In: YES
user_id=1957383
Originator: YES
Hi,
I forgot to say that I first logon and then the browser opens a new window
I switch to. There I've got the problems. Now here is the content of
getPageSource() after submit("logon") from the first page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<META name="GENERATOR" content="IBM WebSphere Studio">
<TITLE> Title </TITLE>
<link rel="stylesheet" href="/****/css/standard.css" type="text/css">
</HEAD>
<BODY>
<H2>****</H2>
<form name="standard"
action="/***/dispatch.do?bt_PRELOGON=1&ticket=***&ref=***"
target=_blank method="POST">
<input type="hidden" name="keepAliveSessionId" value="4712">
<table>
<tr>
<th colspan="2">*** (STD)</th>
</tr>
<tr>
<td><b>*****</b> ****</td>
<td><input type="text" name="*****" value="******"></td>
</tr>
<tr>
<td>*******</td>
<td><input type="text" name="******" value="********"></td>
</tr>
<tr>
<td>********</td>
<td><input type="text" name="*****" value="*******"></td>
</tr>
<tr>
<td>*******</td>
<td><input type="text" name="******" value="******"></td>
</tr>
<tr>
<td>******</td>
<td><input type="text" name="******" value="*****"></td>
</tr>
<tr>
<td>Registration</td>
<td><input type="checkbox" name="registration"
value="true"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" class="button" name="logon" value="Log
on"></td>
</tr>
</table>
</form>
</BODY>
</HTML>
--------------------------
Bye Atop85
----------------------------------------------------------------------
Comment By: Julien HENRY (henryju)
Date: 2007-12-12 08:05
Message:
Logged In: YES
user_id=1235926
Originator: NO
Hi,
Could you please use getPageSource() to display HTML source just after
submit("logon");
++
Julien
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=497983&aid=1849169&group_id=61302
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development