← Back to team overview

sikuli-driver team mailing list archive

[Question #252703]: Trying to typed text in one image but it is typing in some different image.

 

New question #252703 on Sikuli:
https://answers.launchpad.net/sikuli/+question/252703

I am using Sikuli 1.0.1

Same Sikuli version I am using in eclipse

Java version is 1.7.0_45

        [cid:image004.png@01CFB188.1DD8A680]

[cid:image005.jpg@01CFB188.1DD8A680]

I am trying to insert Qty as 1 in first row but sometimes it typed 1 in item box 1 st row or most of the time second row anywhere

PFB script which is in java
package com.intuit;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sikuli.basics.SikuliScript;
import org.sikuli.script.App;
import org.sikuli.script.Button;
import org.sikuli.script.FindFailed;
import org.sikuli.script.Key;
import org.sikuli.script.KeyModifier;
import org.sikuli.script.Location;
import org.sikuli.script.Match;
import org.sikuli.script.Pattern;
import org.sikuli.script.Region;
import org.sikuli.script.Screen;
import org.sikuli.script.SikuliX;

import junit.framework.TestCase;

//SampleTestData_QBDTCA
public class SampleTestData_QBDTCA extends TestCase {

      private static final String x = null;

      private static final String y = null;

      //Sikuli script object
      private SikuliScript m_sikscr;

    //Computer screen object
    private Screen m_screen;
     Region reg;
      int Flag=0;
     // Map map;

    private Pattern m_dropdown;

    private Pattern m_companyname;

  private Pattern m_newTransaction;

  private Pattern e_Item;

  private Pattern e_Qty;

    //Constructor
    public SampleTestData_QBDTCA()
    {

      /////images///
      m_newTransaction = new Pattern("./img/NewTransaction.png");
      e_Item = new Pattern("./img/ItemN.png");
      e_Qty = new Pattern("./img/e_Qty.png");

        //Create Sikuli script and screen objects
        try
        {
            m_sikscr = new SikuliScript();
            m_screen = new Screen();

        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

    //This method is invoked before JUnite test case executes
    @ Before
    public void setUp()
    {

    // App.open("D:\\Build_26_05_2014\\28-07-2014_SVN_3133\\QBOImportUtility_AWS.exe");

        //Wait a bit
       m_screen.wait((double) 3.0);

        try
        {
          /*****************Create a customer******************/
            m_screen.click("./img/QBDTCA_icon.png", 0); // click on next //
            m_screen.click("./img/Customers.png", 0); // click on next //NewCustandjob
            m_screen.click("./img/NewCustandjob.png", 0); // click on next //NewCustandjob
            m_screen.type("N");
            m_screen.type("Customer1");//CustOK
            m_screen.click("./img/CustOK.png", 0); // click on next //NewCustandjob*/

            /*****************Create a Supplier******************/
            m_screen.click("./img/Vendor.png", 0); // click on next //NewCustandjob
            m_screen.click("./img/NewVendor.png", 0); // click on next //NewCustandjob
            m_screen.type("N");
            m_screen.type("Vendor1");//CustOK
            m_screen.click("./img/CustOK.png", 0); // click on next //NewCustandjob

            /*****************Create a inventory item******************/
          /* m_screen.click("./img/Home.png", 0); // click on next //NewCustandjob
            m_screen.click("./img/Item&Serv.png", 0); // click on next //Item

            m_screen.click("./img/Item.png", 0); // click on next //Item
            m_screen.type("N");

            m_screen.click("./img/idropdown.png", 0); // click on next //NewCustandjob
             /* m_screen.wait((double) 3.0);
            m_screen.click("./img/idropdown.png", 0); // click on next //NewCustandjob
            m_screen.wait((double) 3.0);
            m_screen.click("./img/inv.png", 0); // click on next //NewCustandjob
            // m_screen.type("Inventory Part"+Key.ENTER);//inv
            m_screen.wait((double) 3.0); //ItemName
            m_screen.click("./img/ItemName.png", 0); // click on next //NewCustandjob
            m_screen.type("Item1");

            if(m_screen.find("./img/SerRate.png") != null){
                  m_screen.click("./img/Vrate.png", 0); // click on next //NewCustandjob
                  m_screen.type("10");
            }

            if(m_screen.find("./img/Account.png") != null){
                  m_screen.click("./img/VAccount.png", 0); // click on next //NewCustandjob
                  m_screen.type("Owners Draw");
            }

            m_screen.click("./img/CustOK.png", 0); // click on next //NewCustandjob

            m_screen.click("./img/Iclose.png", 0); // click on next //NewCustandjob //NewTransaction

            */

              /****************************************Transaction*****************************************/
            m_screen.click("./img/Customers.png", 0); // click on next //NewCustandjob
            //int i = 0;
            //for(i=0; i<=3; i++){
                  m_screen.click("./img/NewTransaction.png", 0); // click on next //NewCustandjob
                  m_screen.type("E");//
                  m_screen.wait((double) 3.0); //ItemName
                  /*if(m_screen.find("./img/ItemN.png") != null){
                        System.out.println("1");
                        m_screen.click("./img/ItemN.png", 0); // click on next //NewCustandjob
                        m_screen.type("Item1");//
                        System.out.println("2");
                        m_screen.click("./img/Idd.png", 0);

                  }
                  m_screen.wait((double) 3.0); //ItemName
                  if(m_screen.find("./img/Qty.png") != null){
                        System.out.println("3");
                        m_screen.click("./img/VQty.png", 0); // click on next //NewCustandjob
                        m_screen.type("1");//Save&Close
                        System.out.println("4");
                  }
                  m_screen.wait((double) 3.0); //ItemName

                  m_screen.click("./img/Save&Close.png", 0); // click on next //NewCustandjob //NewTransaction*/
                  System.out.println("1");
                  m_screen.type(e_Item, "Item1");
                  m_screen.click("./img/Idd.png", 0);
                  System.out.println("2");
                  m_screen.type(e_Qty, "1");

            System.out.println("3");
            //}

        }
        catch (FindFailed e)
        {
            e.printStackTrace();
        }
    }

    private Pattern Pattern(String string) {
            // TODO Auto-generated method stub
            return null;
      }

      //This method is invoked after JUnit test case is executed
    @ After
    public void tearDown()
    {
        //
      //App.close("ABC");
       //App.close(appName);
    }

    //Test case checks if Yahoo logo exists after login
    @Test
    public void testLogo() throws Exception
    {

        //Wait a bit
        m_screen.wait((double) 3.0);
    }

}

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.