Selecting the next formfield with Selenium RC and python
I am running an automated test to test a webform for my company. They have just installed a zipcode service which automatically adds the Street and City/Region when you fill in the Address and housenumber.
This autofill appears when you deselect the last form element (e.g. that of the housenumber).
This is the order of the fields I'm using;
- form:zipcode
- form:housenumber
- form:addition (optional)
- form:street (gets filled in by service after zipcode and housenumber are provided)
- form:city (the other autofill field)
When you fill this form out manually, the address appears as soon as you click or tab into the addition field (as it is optional) but when it's done automated it doesn't work.
I have t开发者_运维问答ried several things like;
- focus('form:addition') or
- select('form:addition') but these don't work. I have tried
- type('\t') to tab to the form field, and
- type('form:addition', ' ') to type a space into the add. field and even
- type('form:addition', "") to leave it empty. None of these attempts have worked so far.
Is there anyone that can help me with this?
Hi i got a solution for this i think,
problem is with generating the user interactions to the addition field.
use these statements
focus("form:addition");
keyPressNative("10") //this is ENTER command
it should work
Yesterday I found out that the zipcode service uses an Ajax call to retrieve the information. This call is executed when the zipcode and housenumber fields are both 'out of focus' (i.e. deselected).
The right statement I found to use this in my advantage is this;
selenium.fireEvent('form:number', 'blur') which deselects the last field where data was entered.
精彩评论