Monday, 15 March 2010

java - Selenium: Data entered in form with multiple tabs disappears sometimes -


I have a complex data entry form that contains some tabs that contain entry fields for different configuration items. I am writing a test that records data in the field on different tabs and then saves. As soon as I enter each item, I verify that the selected text or value is selected before going to the next step in the Data Entry Control, I sometimes find that, but not always, when I click on another tab Go to the field on the previous tab, the data I entered was lost.

How do I stop it?

I am using Selenium 2 with WebDrive in Java and running trial with Firefox.

I'm having trouble with two areas:

One is a simple text entry field, another is a text entry box with an autocomplete feature

I want to input the last things before switching tabs in both areas. I lose these input data before switching tabs. No other field data can be lost. People who I talk to before I go to a new tab

I have tried to check that JQuery is loaded at the end of the method while sending text to input areas, but this help does not do. This method checks the JQuery returns right and the data is still deleted.

It never happens when the data is entered manually, and it is not in another automatic test where the data is only logged on a tab < P> Here is html for the autocomplete field when the text has been entered and there is no pending input that is autocompleted:

  & lt; Div id = "s2id_autogen5" class = "selection 2-container selection 2-container-multi-select 2" & gt; & Lt; Ul class = "select2-options" style = "" & gt; & Lt; Li class = "select2-search-choice" & gt; & Lt; Div & gt; Html & lt; / Div & gt; & Lt; One class = "select2-search-choice-close" tabindex = "- 1" onclick = "return false;" Href = "#" & gt; & Lt; / A & gt; & Lt; / Li & gt; & Lt; Li class = "select2-search-field" & gt; & Lt; Input class = "select2-input" type = "text" autocomplete = "off" tabindex = "0" style = "width: 10px;" & Gt; & Lt; / Input & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; / Div & gt;   

Here is an html source for plain text entry fields:

     

After struggling with this for a few days, I have a partial solution to my Problem:

For the simple text entry box, if I send a key. To change the focus on the next input field to the next input field, then the data usually is not erased when I switch to another tab on the form, something should happen, when the focus is switched on to other fields (but Not another tab) that do not fire when using only the KI sent to enter the text. However, in some cases, the data still disappears occasionally.

For input with an autocomplete feature, I had to send a key. Start or key TAB successfully enter the text in the field. With this field, you can either select an option from the autocomplete list or press an Entry Key or Tab key for the input text, which does not match any of the AutoCopple options. After entering the text with keys.RETURN or keys.Eb, I have to change the focus by sending a key to something. TAB Again, I believe this is an incident that has to be set to maintain the data and that event is removed only after turning it into focus in any other input field, but if I switch tabs I do not think so. > Checking that JQuery does not have any active requests, because in some cases, when no active queries occur, the data still disappears from one or both areas.

The method that eliminates this problem in all situations, I do not want to keep the hard code in sleep, perhaps a better technique to wait better in a non-coded way? I would love to solve my problem completely because seeing that this solution is not stupid. I can not accept it as an answer to the question.

No comments:

Post a Comment