The Royal Nick Humphrey Global World IT Forum, Home Edition  

Go Back   The Royal Nick Humphrey Global World IT Forum, Home Edition > Programmering Forum > Testing forum > Selenium forum
FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
  #1  
Old 04-05-09, 17:17
Nickleus's Avatar
Nickleus Nickleus is offline
Nick Humphrey - Admin
 
Join Date: 06 Apr 2004
Location: Noreg
Posts: 2,794
Send a message via MSN to Nickleus Send a message via Skype™ to Nickleus
Default selenium - waitfortext not working

here's my test in plain words:
* i have a table of users. 1 user on each row. at the end of each row there are two buttons: Edit | Remove
* click the Remove button (it has an id called remove_testbruker1)
* when i click the Remove button, a span next to it, containing the text Delete testbruker1?, with buttons Yes | No, will be made visible using css
* click Yes to delete the user
* check to see that the username is no longer present on the page (it has been deleted)

i was using code like this:
Code:
...
<tr>
    <td>click</td>
    <td>id=remove_testbruker1</td>
    <td></td>
</tr>
<tr>
    <td>waitForText</td>
    <td>Yes</td>
    <td></td>
</tr>
<tr>
    <td>clickAndWait</td>
    <td>Yes</td>
    <td></td>
</tr>
<tr>
    <td>assertTextNotPresent</td>
    <td></td>
    <td>testbruker1</td>
</tr>
...
i don't know why, but selenium wasn't finding the Yes button. the assertTextNotPresent also wasn't working, even though i finally got the Yes button to finally fire (see below), selenium still saw the username on the page, and i *think* i know why, i have a hunch that it was because i was using clickAndWait right before it and because the delete call is an ajax call so there is no page refresh (someone please correct me if i'm wrong), so after 2 rewrites i came up with this code:
Code:
<tr>
    <td>click</td>
    <td>id=remove_testbruker1</td>
    <td></td>
</tr>
<tr>
    <td>click</td>
    <td>//input[@value='Yes' and @type='button' and @onclick=&quot;document.getElementById('confirmBoxtestbruker1').style.visibility='hidden';this.form.submit();&quot;]</td>
    <td></td>
</tr>
<tr>
    <td>waitForTextNotPresent</td>
    <td>testbruker1</td>
    <td></td>
</tr>
and it worked. the //input ... is the xpath to the Yes button inside the span.
(see attachment: Endre == Edit, Fjern == Remove, Ja == Yes, Nei == No)
Attached Images
 
__________________
Nick Humphrey
Download for free my experimental music, art, poetry and pictures.
My album Classic E B-sides can be purchased on both itunes and amazon.com.
Help me improve my phrasebook of world languages.
I offer remote healing services.
My blog.

Last edited by Nickleus : 04-05-09 at 17:27.
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
selenium api reference examples Nickleus Selenium forum 0 04-05-09 10:37
selenium - error link=XXX not found even though verifyTextPresent XXX is found Nickleus Selenium forum 0 30-04-09 11:11
ubuntu - acer travelmate 6292 wireless problem - not working or connecting Nickleus Ubuntu Linux forum 0 21-01-09 09:20
keyboard shortcut ctrl+i to fix indentation not working in build.xml file Nickleus Eclipse forum 0 14-01-09 13:20
Google Search advanced operator date not working? Nickleus Google Forum 0 09-08-06 10:32


All times are GMT +2. The time now is 03:52.


Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Check out my phrasebook
All rights reserved 2004-2009