[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

Reply via email to