Well, 
 
generally clickButtonWithText() seems to work.
But in some important cases within my application that i have to test it 
doesn't.
 
for example when trying to logout from this page:
 
<form action="/abxadmin/-" method="post" id="login-status" class="login" 
name="login-status">
        <script type="text/javascript">Form_hookup('login-status');</script> 
        
        
                You are logged in as user <b>system</b>.
        <p>

                <div class="buttons"><button type="button" 
onclick="submitEvent('login-status', 'logout', true, 
this)">Logout</button></div>
        </p>
        

<input type="hidden" name="$part" 
value="AdminCommon.Welcome.index.login-status" />
<input type="hidden" name="$event$" />
</form>
When using:
 public void logout() throws Exception {
  clickLinkWithText("English");
  assertTextPresent("You are logged in as user");
  setWorkingForm("login-status");
  clickButtonWithText("Logout");
  assertTextPresent("User Login");
  assertFormPresent("login");
 }
it seems that clickButtonWithText works because it does not throw any exception 
or something else. But the logout event does not execute. I am still on the 
same page.
Any suggestions?
 
Greetings,
 
Dirk.
 
________________________________

Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Julien HENRY
Gesendet: Dienstag, 23. Januar 2007 19:10
An: Usage problems for JWebUnit
Betreff: [JWebUnit-users] Re : stuck with <button> and <textarea>


Hi Dirk,

What about clickButtonWithText() ?

Concerning TextArea, I will take a look on it.

++

Julien


----- Message d'origine ----
De : Dirk Jerusalem <[EMAIL PROTECTED]>
À : Usage problems for jWebUnit <jwebunit-users@lists.sourceforge.net>
Envoyé le : Mardi, 23 Janvier 2007, 17h15mn 34s
Objet : [JWebUnit-users] stuck with <button> and <textarea>


Hi jWebUnit-Users,
 
I'm stuck with <button>-tags. They normally have their description in the body, 
and in my case they have neither attribute "id" nor "value".
So I tried with XPath. 
 
I used this little html-code:
 
<html>
<body>
 <h1>ButtonTest</h1><br>
 <form>
     <p>
        <textarea id="textfeld" cols="20" rows="4" name="textfeld"></textarea>
        <button type="button" id="Text1" value="Text2" name="Text1" 
onclick="this.form.textfeld.value='Text 1 und rückwärts seltsam geschrieben ich 
bin.'">Text1</button>
        <button type="button" id="Text2" value="Text2" name="Text2" 
onclick="this.form.textfeld.value='Ich bin Text 2 - ganz normal'">Text2</button>
     </p>
 </form>
 
</body>
</html>
 
so I could try using clickButton, clickButtonWithText and clickElementByXPath:
 
 public void testButtonWithXPath()
 {
  assertTextPresent("ButtonTest");
  assertElementPresentByXPath("//button[text()='Text1'");
  clickElementByXPath("//button[text()='Text1'");
  assertTextPresent("Text 1 und rückwärts seltsam geschrieben ich bin.");
  clickElementByXPath("//button[text()='Text2'");
  assertTextPresent("Ich bin Text 2 - ganz normal");
 }
 
 public void testButtonWithID()
 {
  assertTextPresent("ButtonTest");
  clickButton("Text1");
  assertTextInElement("textfeld", "Text 1 und rückwärts seltsam geschrieben ich 
bin.");
  clickButton("Text2");
  assertTextInElement("textfeld", "Ich bin Text 2 - ganz normal");
 }
 
 public void testButtonWithValue()
 {
  assertTextPresent("ButtonTest");
  clickButtonWithText("Text1");
  assertTextInElement("textfeld", "Text 1 und rückwärts seltsam geschrieben ich 
bin.");
  clickButtonWithText("Text2");
  assertTextInElement("textfeld", "Ich bin Text 2 - ganz normal");
 }
 
testButtonWithXPath() can not find the button. I don't know why. I checked it 
with the Firefox plugin "XPath Checker" which found it that way.
 
Anyway I wondered why there is no function to check the body of buttons? This 
would be valuable for jWebUnit-users, or did I miss some other simple way?
 
But with this demo I realized that neither assertTextPresent nor 
assertTextInElement or assertTextFieldEquals are able to get the text out of 
the textarea ...
How can I do this?


Thanx for any help in advance,
 
Dirk.
 
[->] Dirk Jerusalem
Quality Software Engineer & Service Engineer
Research & Development 

[->] abaXX Technology AG
Forststr. 7 · 70174 Stuttgart · Germany
Phone: +49 1805 222-994
Fax: +49 1805 222-993
Mail: [EMAIL PROTECTED]
Surf~In: support.abaXX.de
Web: www.abaXX.de

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users



________________________________

Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Profitez des connaissances, des opinions et des expériences des internautes sur 
Yahoo! Questions/Réponses 
<http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com> .
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
JWebUnit-users mailing list
JWebUnit-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jwebunit-users

Reply via email to