Note: This e-mail is subject to the disclaimer contained at the bottom of this message.



Thanks to Mike and Robin for your input

Robin, the actual problem is to click on the item in the ajax 'thingy' list (step 3) as I don't know how to specify xpath or DOM _expression_ to locate clickable list element with value 'AMAZON'
here's what I'm trying to do
.......
|type|_textElementId|AM
|assertElementPresent|_ajaxDisplayArea| 
<!-- now click ajax list item with value 'AMAZON' -->
|click|xpath=//[EMAIL PROTECTED]'AMAZON']|&nbsp;         - JSH: selenium breaks here as innerHTML is not an attribute but nested property
<!-- after ajax list item has been selected the hidden field should have the value set to itemOid selected
|waitForValue|_hiddenElementId|OID_OF_AMAZON_ITEM


this is how relevant DOM section look like after step 2:

DIV ID(_ajaxDisplayArea)
    DIV
    SPAN
    SPAN
  IFRAME ID(_ajaxFrame)

Another question to Mike, David Kemp and Robin is how to TAB out of text field in selenium - please note
 |fireEvent|_textElementId|blur  
does not work as ajax has already hijacked and redefined onBlur  handler

thanks

JSH


[EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]

16/11/2005 07:00 AM
Please respond to selenium-users

       
        To:        selenium-users@lists.public.thoughtworks.org
        cc:        
        Subject:        Selenium-users Digest, Vol 13, Issue 14


Send Selenium-users mailing list submissions to
        selenium-users@lists.public.thoughtworks.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Selenium-users digest..."


Today's Topics:

   1. Re: Finding the order of occurence elements / text
      (Rahul Chaturvedi)
   2. Re: Selenium handling of AJAX autocomplete 'virtual'        lists
      (Mike Williams)
   3. Re: Re: Finding the order of occurence elements /        text
      (David Kemp)
   4. Re: Selenium handling of AJAX autocomplete 'virtual'        lists
      (Robin Becker)


----------------------------------------------------------------------

Message: 1
Date: Tue, 15 Nov 2005 15:20:51 +0530
From: Rahul Chaturvedi <[EMAIL PROTECTED]>
Subject: [Selenium-users] Re: Finding the order of occurence elements
        / text
To: selenium-users@lists.public.thoughtworks.org
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

Thanks for your replies .I have used following approach to find the position
of two elements relative to each other.

I have added the following functions in user-extentions.js

Selenium.prototype.assertElementAbove = function(locator1, locator2) {

var element1 = this.page().findElement(locator1);

var element2 = this.page().findElement(locator2);

// Get Y coordinates of elements

var Y1 = findPosY(element1);

var Y2 = findPosY(element2);

if(parseFloat(Y1) < parseFloat(Y2))

{

Assert.matches('1', '1');

// here I wanted a command which tells selenium that the test is correct and
as I don't know that I matched 1 with 1

}

else

{

Assert.matches('First element is below or at the same place as second
','1','2');

// here I wanted a command which tells selenium that the test is failed and
as I don't know that I matched 1 with 2

}

};

function findPosY(obj)

{

var curtop = 0;

if (obj.offsetParent)

{

while (obj.offsetParent)

{

curtop += obj.offsetTop

obj = obj.offsetParent;

}

}

else if (obj.y)

curtop += obj.y;

return curtop;

}

and used following code in my test script

<!-- to find if "Print my bill" is above "Bill messages" link -->

<tr>

<td>verifyElementAbove</td>

<td>link=Print my bill</td>

<td>link=Bill messages</td>

</tr>

Its running fine and there are no issues with it.

*BUT* as you see I have used Assert.matches('1', '1'); to make sure that
this test pass when if condition is satisfied and Assert.matches('First
element is below or at the same place as second ','1','2'); where it fails.
This is just a work around as I don't know what command is there to tell
selenium that the test is correct / incorrect

Does anyone has idea if there is some command like assertGreater etc. or any
other better way to do that.

Regards,

Rahul Chaturvedi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.public.thoughtworks.org/pipermail/selenium-users/attachments/20051115/cf66997a/attachment-0001.htm

------------------------------

Message: 2
Date: Tue, 15 Nov 2005 21:05:43 +1100
From: Mike Williams <[EMAIL PROTECTED]>
Subject: Re: [Selenium-users] Selenium handling of AJAX autocomplete
        'virtual'        lists
To: selenium-users@lists.public.thoughtworks.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

[EMAIL PROTECTED] wrote:

> I need selenium to select a value in the ajax - generated select list
> (step 3 in sequence below) after selenium 'types' first few
> characters of the word into associated text input field

Hi Jake.  Long time no see.

After Selenium has executed a command, it can be set to wait until some
condition is true before continuing.  Basically, it will poll until the
"readyToContinue" condition is true.  Typically the condition is that a
new page has loaded, and is set up by appending "AndWait" to a command.

However, a while back David Kemp added the "waitForValue" command, which
will cause Selenium to wait (ie. poll) until a certain input element has
a specified value.  This can be used to wait until an asynchronous event
(ie. AJAX) has populated a form field.

(Proviso: "waitForValue" only does exact matching of the value right now
... but it could easily be changed to use PatternMatcher.)

Take a look at the source for doWaitForValue(); it's pretty
straightforward.  If it's not suitable for your purposes, it should be
relatively easy to roll your own doWaitForSomethingElse() function.

Hope that helps.

--
cheers, MikeW                            http://www.dogbiscuit.org/mdub/


------------------------------

Message: 3
Date: Tue, 15 Nov 2005 20:19:14 +1000
From: David Kemp <[EMAIL PROTECTED]>
Subject: Re: [Selenium-users] Re: Finding the order of occurence
        elements /        text
To: selenium-users@lists.public.thoughtworks.org
Message-ID:
        <[EMAIL PROTECTED]>
       
Content-Type: text/plain; charset="us-ascii"

[EMAIL PROTECTED] wrote on 15/11/2005
08:50:51 PM:

> if(parseFloat(Y1) < parseFloat(Y2))
> {
> Assert.matches('1', '1');
> // here I wanted a command which tells selenium that the test is
> correct and as I don't know that I matched 1 with 1
> }
> else
> {
> Assert.matches('First element is below or at the same place as second
> ','1','2');
> // here I wanted a command which tells selenium that the test is
> failed and as I don't know that I matched 1 with 2
> }
> };


Try this instead:

if(parseFloat(Y1) >= parseFloat(Y2))
{
    Assert.fail('First element is below or at the same place as second');
};


David Kemp
ThoughtWorks Australia Pty Ltd
http://www.thoughtworks.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.public.thoughtworks.org/pipermail/selenium-users/attachments/20051115/da48eeea/attachment-0001.htm

------------------------------

Message: 4
Date: Tue, 15 Nov 2005 10:40:54 +0000
From: Robin Becker <[EMAIL PROTECTED]>
Subject: Re: [Selenium-users] Selenium handling of AJAX autocomplete
        'virtual'        lists
To: selenium-users@lists.public.thoughtworks.org
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed

[EMAIL PROTECTED] wrote:
> _______________________________________________________________________________________
>
> Note: This e-mail is subject to the disclaimer contained at the bottom of this message.
> _______________________________________________________________________________________
>
>
> Greetings,
>
> I need selenium to select a value in the ajax - generated select list (
> step 3 in sequence below )
> after selenium 'types' first few characters of the word into associated
> text input field
>
> Without selenium the sequence is following:
>
> 1. type 'AM' in text field id='123'
> 2. ajax drop-down list appears with AM* entries like ['AMA', 'AMG', ... ,
> 'AMAZON BOOKS'  .... ]
> 3. click on any list item (or mouseClick and Enter)
> 4. list's _javascript_ event handler populates text field id='123'  with
> value selected from the list
> 5. ....the rest of the page lists get populated based on selection above
>
> Any help will be greatly appreciated
.....

you don't say what the problem is. I have recently been through this exercise of
handling AJAX with selenium and found two problems.

1) waiting on dynamically loaded content.
2) waiting for the target page DOM to construct stuff.

My answer to 2) was simple just pause an appropriate amount of time. I tried
pausing for 1), but that didn't work when the server got transatlantic and
latency was larger.

My answer to 1) was approximately as follows.

add selenium commands

prepareForAjax & waitForAjax.

prepareForAjax started waiting for all my target page ajax objects to be sent.
waitForAjax waited until all the ajaxy things started since the call of
prepareForAjax had finished and then paused for the data to be processed.

The test then looked like

prepareForAjax||
click|myajaxthingy|
waitForAjax|1000|wait on the ajax and then some

Sounds pretty easy, but was in fact quite hard and took some effort to get
things working properly. The main problem was how to get at all the activated
ajax things. I guess a proper approach would be to wrap the XMLHttpRequest
object in the target page so it did that for us, but I had already got my own
wrapper and had to hack that to provide onSend and onFinish events (my wrapper
always finishes perhaps with error/timeout) so I can guarantee that the wait for
the async stuff will eventually terminate.
--
Robin Becker


------------------------------

_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users


End of Selenium-users Digest, Vol 13, Issue 14
**********************************************


The information transmitted in this message and its attachments (if any) is intended only for the person or entity to which it is addressed.

The message may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon this information, by persons or entities other than the intended recipient is prohibited.

If you have received this in error, please contact the sender and delete this e-mail and associated material from any computer.

The intended recipient of this e-mail may only use, reproduce, disclose or distribute the information contained in this e-mail and any attached files, with the permission of the sender.

This message has been scanned for viruses with Symantec Scan Engine and cleared by MailMarshal.


_______________________________________________
Selenium-users mailing list
Selenium-users@lists.public.thoughtworks.org
http://lists.public.thoughtworks.org/mailman/listinfo/selenium-users

Reply via email to