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=****_***&amp;rai=0&amp;bt_TXN=do'">
 <NOSCRIPT>
  <A href="dispatch.do;
jsessionid=*******************:-1?ref=1500_****&amp;+
rai=0&amp;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-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&amp;ref=1500_***&amp;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_***&amp;rai=0&amp;bt_TXN=do'">
                  <NOSCRIPT>
                    <A
href="dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?ref=1500_****&amp;rai=0&amp;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_****&amp;rai=0&amp;bt_STMTLIST=do'">
                  <NOSCRIPT>
                    <A
href="dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?ref=1500_****&amp;rai=0&amp;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>
            &nbsp;</TD>
          <TD class="contentColumn">
            <DIV align="center">
              <TABLE width="633" border="0" cellspacing="0"
cellpadding="0">
                <TR>
                  <TD class="tabBreadcrumb">
                    Home &gt;&gt; 
                    <A
href="dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?bt_ACCBAL=do&amp;ref=1500_****&amp;rai=0"
class="breadcrumb" onfocus="if(this.blur)this.blur()">TextOne</A>
                    &gt;&gt; ***</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_****&amp;rai=0&amp;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">
                          &nbsp;</TD>
                        <TD class="tabdata">
                          <A
href="dispatch.do;jsessionid=0000avY5k9iasDX7-HH19z3V0nj:-1?bt_ACTMD%5ESHOW=do&amp;ref=1500_****&amp;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">
            &copy; ******</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&amp;ticket=***&amp;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>&nbsp;</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://sourceforge.net/services/buy/index.php
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to