Topic
28 replies Latest Post - ‏2014-06-18T07:55:34Z by Sathish804
ChrisGF
ChrisGF
158 Posts
ACCEPTED ANSWER

Pinned topic Textfield focus in Table

‏2014-06-12T08:34:20Z |

Hello,

I have an application where we have a table and in the table there is a textfield. I recorded my test and somehow after a while the test failed.

The Problem is that now the Focus is not visible in the cell anymore where my test changes the table cell value.

The mouse is above the cell but the table is not getting the Focus anymore :(((

Could someone help me out?

Every Idea is welcomed!

This is the line I have:

iTable28().drag(atCell(atRow(0), atColumn("ColumnName")), atPoint(84,6), atCell(atRow(0), atColumn("ColumnName")), atPoint(84,7)); 

I tried to use displayscreen but it did not work eighter...

I have RFT Version: 8.5.1.1

Updated on 2014-06-12T08:34:48Z at 2014-06-12T08:34:48Z by ChrisGF
  • Sathish804
    Sathish804
    1276 Posts
    ACCEPTED ANSWER

    Re: Textfield focus in Table

    ‏2014-06-12T09:38:38Z  in response to ChrisGF

    In this situation Its wise to use programatic approach rather than recording it.

    Total how many text  fields are there in your table??

     

    The approach for this is to first find the text boxes from the table using find method using its properties.

    Assuming if you have text boxes in only one column then find method can fetch the text boxes in the rows order of table.

    TestObject[] textBoxes = iTable28().find(atDescendant(".class","Htnl.INPUT.text"));

    //If your text box is in first row then call like this.

    new TextGuiSubitemTestObject(to[0]).setText("Text to Input")

     

    • ChrisGF
      ChrisGF
      158 Posts
      ACCEPTED ANSWER

      Re: Textfield focus in Table

      ‏2014-06-12T12:56:00Z  in response to Sathish804

      Thank you for your fast answer.

      Well we have many lines in th table and in the last column are the textfiels.

      Maybe the atDescendant() Need other Parameters because I do not work with Webpages but with application.

      Could you tell me how to modify the following line according th the application?:

      TestObject[] textBoxes = iTable28().find(atDescendant(".class","Html.INPUT.text"));

      • Sathish804
        Sathish804
        1276 Posts
        ACCEPTED ANSWER

        Re: Textfield focus in Table

        ‏2014-06-12T13:33:00Z  in response to ChrisGF

        Below code gets all the text boxes form the table. But check the text box .class property value from the Object map and modify that in the code.

        TestObject[] textBoxes = iTable28().find(atDescendant(".class","textBoxClass"));

        Updated on 2014-06-12T13:34:13Z at 2014-06-12T13:34:13Z by Sathish804
        • ChrisGF
          ChrisGF
          158 Posts
          ACCEPTED ANSWER

          Re: Textfield focus in Table

          ‏2014-06-13T08:19:13Z  in response to Sathish804

          Hi!

          It did not work with the "textBoxClass"....

          but I could Change the value like this:

           

          ITestDataTable readTable = (ITestDataTable) iTable28().getTestData("visible contents");

           

          int j = readTable.getColumnCount()-1;

          int i= readTable.getRowCount()-1;

           

          readTable.setCell(0, j,"58");

          System.out.println("Cell data: "+readTable.getCell(0,j));

           

          The only thing what is missing is to write it back into the swing application table. I mean:

          How can I make the Table28() to make the new value visible??

           

          Thank you in advance,

          K

           

          Updated on 2014-06-13T08:30:44Z at 2014-06-13T08:30:44Z by ChrisGF
          • Sathish804
            Sathish804
            1276 Posts
            ACCEPTED ANSWER

            Re: Textfield focus in Table

            ‏2014-06-16T07:57:49Z  in response to ChrisGF

            "textBoxClass"... this is not the actual value of the class, I gave that text so that you can go and find it in the Object map to see what is the actual value of the .class property value of the text box.

             

            • Sathish804
              Sathish804
              1276 Posts
              ACCEPTED ANSWER

              Re: Textfield focus in Table

              ‏2014-06-16T07:59:35Z  in response to Sathish804

              Please post the screen shot of your object map with the text box object recognition properties.

              • ChrisGF
                ChrisGF
                158 Posts
                ACCEPTED ANSWER

                Re: Textfield focus in Table

                ‏2014-06-16T08:35:32Z  in response to Sathish804

                Hope this attachment helps.

                Please write me an example because I`m not sure what you mean..

                Thank you in advance,

                K

                Attachments

                • Sathish804
                  Sathish804
                  1276 Posts
                  ACCEPTED ANSWER

                  Re: Textfield focus in Table

                  ‏2014-06-16T08:44:31Z  in response to ChrisGF

                  Please post the same screen shot with Recognition tab highlighted.

                  • ChrisGF
                    ChrisGF
                    158 Posts
                    ACCEPTED ANSWER

                    Re: Textfield focus in Table

                    ‏2014-06-16T09:37:27Z  in response to Sathish804

                    This is it.

                    • Sathish804
                      Sathish804
                      1276 Posts
                      ACCEPTED ANSWER

                      Re: Textfield focus in Table

                      ‏2014-06-16T13:09:37Z  in response to ChrisGF

                      Sorry that was not I asked.

                      In Object map you took the screen shot of the correct object but with its administrative properties.. but I want you to provide a screen shot of same object with Recognition properties.

                      Please refer to attached screen shot for recognition properties tab in object map.

                      Once you can provide this then I can help you with a way to enter text into that text box.

                      Attachments

                      • ChrisGF
                        ChrisGF
                        158 Posts
                        ACCEPTED ANSWER

                        Re: Textfield focus in Table

                        ‏2014-06-16T13:36:10Z  in response to Sathish804

                        Sorry, OK now I attached the Table and the Textfield Recognition Property screenshots

                        • Sathish804
                          Sathish804
                          1276 Posts
                          ACCEPTED ANSWER

                          Re: Textfield focus in Table

                          ‏2014-06-17T07:46:25Z  in response to ChrisGF

                          Try this code..

                           

                           
                          TestObject[] to= iTable28().find(atDescendant(".class","com.ibm.abaf.ui.widgets.EntryField"));

                           

                          //If your text box is in first row then call like this.

                           

                          new TextGuiSubitemTestObject(to[0]).setText("Text to Input")
                          Updated on 2014-06-17T07:46:44Z at 2014-06-17T07:46:44Z by Sathish804
                          • ChrisGF
                            ChrisGF
                            158 Posts
                            ACCEPTED ANSWER

                            Re: Textfield focus in Table

                            ‏2014-06-17T10:56:25Z  in response to Sathish804

                            somehow there is no data in the testobject. It seems the table object is empty (see attachment).:

                            • exception_name = java.lang.ArrayIndexOutOfBoundsException
                            • exception_message = 0
                            • script_name = GEB.TestfallGEB000105
                            • script_id = GEB.TestfallGEB000105.java
                            • line_number = 279
                            • exception_stack = at GEB.TestfallGEB000105.testMain(TestfallGEB000105.java:279)
                            •  

                            Attachments

                            • nchaturv
                              nchaturv
                              34 Posts
                              ACCEPTED ANSWER

                              Re: Textfield focus in Table

                              ‏2014-06-17T11:28:48Z  in response to ChrisGF

                              Hi,

                                  I was going through this discussion and I believe this line

                              TestObject[] to= iTable28().find(atDescendant(".class","com.ibm.abaf.ui.widgets.EntryField"));

                                 should fetch you all the edit boxes. Can you please let me know , how many objects are getting returned with this find.

                                  You can do it by writing a line to print the count of object as follows,

                                 System.out.println(to.length());

                               

                              Thanks

                              • ChrisGF
                                ChrisGF
                                158 Posts
                                ACCEPTED ANSWER

                                Re: Textfield focus in Table

                                ‏2014-06-17T12:10:43Z  in response to nchaturv

                                The length is 0.

                                You can see it in the TableEmpty.jpg :(

                                I even tried to call this line

                                iTable28().getTestData("visible contents");

                                before the find method call.

                                But ist empty.

                                • Sathish804
                                  Sathish804
                                  1276 Posts
                                  ACCEPTED ANSWER

                                  Re: Textfield focus in Table

                                  ‏2014-06-17T12:15:45Z  in response to ChrisGF

                                  Modify the find method like this and see if your are getting anything from the find method

                                   

                                  TestObject[] to= iTable28().find(atDescendant(".class","com.ibm.abaf.ui.widgets.EntryField"), false);

                                  • ChrisGF
                                    ChrisGF
                                    158 Posts
                                    ACCEPTED ANSWER

                                    Re: Textfield focus in Table

                                    ‏2014-06-17T12:48:50Z  in response to Sathish804

                                    I`m sorry but nothing has changed.... I tried your line:

                                    sleep(1.500);

                                    iTable28().getTestData("visible contents");

                                    TestObject[] to= iTable28().find(atDescendant(".class","com.ibm.abaf.ui.widgets.EntryField"), false);

                                     

                                    TestObject[] to2= iTable28().find(atDescendant("name","Betrag"), false);

                                    TestObject[] to3= iTable28().find(atDescendant(".class","com.ibm.abaf.ui.widgets.wrappers.ITable"), false);

                                    //If your text box is in first row then call like this.

                                    System.out.println("TestObject Length: " + to.length);

                                    new TextGuiSubitemTestObject(to[0]).setText("Text to Input");

                                     

                                    and nothing happens. the testobject is still empty.

                                    What more can we do?

                                    • Sathish804
                                      Sathish804
                                      1276 Posts
                                      ACCEPTED ANSWER

                                      Re: Textfield focus in Table

                                      ‏2014-06-17T13:00:13Z  in response to ChrisGF

                                      Please explain is the following scenario is true for your text object.

                                      1) Is it visible directly in the table as text box??

                                      2) you need to click on the cell to activate the cell and populate the Text box??

                                       

                                      If it is the case 1 the code sample which I gave will work, but if the for the case 2 you need to add additional step as mentioned by Nitin to click on the table cell before using the find method.

                                      • ChrisGF
                                        ChrisGF
                                        158 Posts
                                        ACCEPTED ANSWER

                                        Re: Textfield focus in Table

                                        ‏2014-06-17T14:00:27Z  in response to Sathish804

                                        Thank you!!!  OK. I tried to add the celll click and now the testobject has the length 1.

                                        So we have the cell now. but with the line

                                        new TextGuiSubitemTestObject(to[0]).setText("58");

                                          I try to chane the value and nothing happens...

                                        How is it possible?

                                • nchaturv
                                  nchaturv
                                  34 Posts
                                  ACCEPTED ANSWER

                                  Re: Textfield focus in Table

                                  ‏2014-06-17T12:19:41Z  in response to ChrisGF

                                  Can you place the line which you recorded earlier before the code to find the text box,

                                  iTable28().drag(atCell(atRow(0), atColumn("ColumnName")), atPoint(84,6), atCell(atRow(0), atColumn("ColumnName")), atPoint(84,7));

                                  TestObject[] to= iTable28().find(atDescendant(".class","com.ibm.abaf.ui.widgets.EntryField"));

                                  Probably you need to click before the Edit Box widget gets loaded.

                                   

                                  • ChrisGF
                                    ChrisGF
                                    158 Posts
                                    ACCEPTED ANSWER

                                    Re: Textfield focus in Table

                                    ‏2014-06-17T13:03:45Z  in response to nchaturv

                                    The last Thing I do before the iTable28() is clicking on a search button and than the table appears below with the data. But in the iTable28() I dont fint anything. The red line makes a check and the table has the right value in the VP. These where the lines before the TestObject ( now they are commented out):

                                     

                                    datumSearch().click();

                                    iTable28().performTest(Betrag_visibleContentsVP(), 2.0, 20.0);

                                    // iTable28().drag(atCell(atRow(0),atColumn("Betrag")), atPoint(84,6), atCell(atRow(0), atColumn("Betrag")), atPoint(84,7));

                                    // grFVersion143419().inputKeys("{BKSP}");

                                    // sleep(1);

                                    // gFVersion143419().inputKeys("{Num5}{Num8}{ENTER}");

                                     But the number 58 never appeard in the textfield. It was strange that when I clicked on the textfield in the table

                                  • ChrisGF
                                    ChrisGF
                                    158 Posts
                                    ACCEPTED ANSWER

                                    Re: Textfield focus in Table

                                    ‏2014-06-17T14:05:57Z  in response to nchaturv

                                    now I added this line before so we can get the cell:

                                    iTable28().drag(atCell(atRow(0), atColumn("Betrag")), atPoint(84,6), atCell(atRow(0), atColumn("Betrag")), atPoint(84,7));

                                     gFV143419().inputKeys("{BKSP}");

                                    and in the object length I see 1 instead of 0. But the writing back in the cell does not work...or nothing happens after the last line new TextGuiSubitemTestObject(to[0]).setText("58");

                                    • Sathish804
                                      Sathish804
                                      1276 Posts
                                      ACCEPTED ANSWER

                                      Re: Textfield focus in Table

                                      ‏2014-06-17T14:11:54Z  in response to ChrisGF

                                      Change like this and try.

                                      TextGuiSubitemTestObject textBox = new TextGuiSubitemTestObject(to[0]);

                                      textBox.click();

                                      sleep(1)

                                      textBox.setText("58");

                                      //If the above line not works then try this

                                      getScreen().inputChars("58");

                                       

                                      • ChrisGF
                                        ChrisGF
                                        158 Posts
                                        ACCEPTED ANSWER

                                        Re: Textfield focus in Table

                                        ‏2014-06-17T14:27:19Z  in response to Sathish804

                                        Well.. tried both and None of them worked. But I observed something strange. When your lines click on the cell the Focus first goes into the textfield and immediately jumps the Focus on the cell and does not in the textfield within the cell....

                                         

                                        • Sathish804
                                          Sathish804
                                          1276 Posts
                                          ACCEPTED ANSWER

                                          Re: Textfield focus in Table

                                          ‏2014-06-17T15:04:26Z  in response to ChrisGF

                                          That is the general approach what we will do, if your object is behaving like that I advise you to reach the developer to change its behaviour on click to keep the focus on text box.

                                          • ChrisGF
                                            ChrisGF
                                            158 Posts
                                            ACCEPTED ANSWER

                                            Re: Textfield focus in Table

                                            ‏2014-06-18T07:41:40Z  in response to Sathish804

                                            OK. I found the solution....jejeje!

                                            I had to make an application resize like this:

                                            gFVersion143419().minimize();

                                            sleep(1);

                                            gFVersion143419().maximize();

                                            and after these lines I tried to click on the field and change the value.

                                            Fortunatelly it worked :)

                                             

                                            Thanks to both of you for the energy and effort to get this done!!!

                                             

                                             

        • ChrisGF
          ChrisGF
          158 Posts
          ACCEPTED ANSWER

          Re: Textfield focus in Table

          ‏2014-06-16T06:38:35Z  in response to Sathish804

          So what do you think how can I set back the data into the GuiSubitemTestObject called table28() (from the ITestDataTable) ??

          Updated on 2014-06-16T06:40:43Z at 2014-06-16T06:40:43Z by ChrisGF