Пример #1
0
        static void Main(string[] args)
        {
            SAPTestHelper.Current.SetSession();

            SAPTestHelper.Current.SAPGuiSession.StartTransaction("VA01");

            SAPTestHelper.Current.SAPGuiSession.StartRequest += (s) => {
                SAPTestHelper.Current.TakeScreenShot(SAPTestHelper.Current.ScreenDatas.Count.ToString() + ".jpg");
                Console.WriteLine(SAPTestHelper.Current.ScreenDatas.Count);
            };
            //Console.ReadLine();
            //SAPTestHelper.Current.TurnScreenLog(true);
            SAPTestHelper.Current.SAPGuiSession.EndTransaction();

            DemoScript script = new DemoScript();

            script.CurFrom  = "EUR";
            script.CurTo    = "USD";
            script.RateType = "M";
            DemoScript.RunAction(script);

            //SAPTestHelper.Current.TurnScreenLog(false);
            var           screen = SAPTestHelper.Current.ScreenDatas;
            XmlSerializer xs     = new XmlSerializer(typeof(List <ScreenData>));

            using (FileStream fs = new FileStream("test.xml", FileMode.Create))
            {
                xs.Serialize(fs, new List <ScreenData>(screen));
            }
        }
Пример #2
0
 public static void RunAction(DemoScript Data)
 {
     SAPTestHelper.Current.SAPGuiSession.FindById("wnd[0]").ThrowNotFoundError("Can't found window wnd[0]").OfType <GuiFrameWindow>().SendVKey(0);
     SAPTestHelper.Current.SAPGuiSession.FindById <GuiOkCodeField>("wnd[0]/tbar[0]/okcd").Text = "se16";
     SAPTestHelper.Current.SAPGuiSession.FindById <GuiMainWindow>("wnd[0]").SendVKey(0);
     SAPTestHelper.Current.SAPGuiSession.FindById <GuiCTextField>("wnd[0]/usr/ctxtDATABROWSE-TABLENAME").Text = "TCURR";
     SAPTestHelper.Current.SAPGuiSession.FindById <GuiButton>("wnd[0]/tbar[0]/btn[0]").Press();
     SAPTestHelper.Current.SAPGuiSession.FindById <GuiCTextField>("wnd[0]/usr/ctxtI1-LOW").Text = Data.RateType;
     SAPTestHelper.Current.SAPGuiSession.FindById <GuiCTextField>("wnd[0]/usr/ctxtI2-LOW").Text = Data.CurFrom;
     SAPTestHelper.Current.SAPGuiSession.FindById <GuiCTextField>("wnd[0]/usr/ctxtI3-LOW").Text = Data.CurTo;
     SAPTestHelper.Current.TakeScreenShot(@"\\yanzhou17.asiapacific.hpqcorp.net\Shared Folder\8.jpg");
     SAPTestHelper.Current.SAPGuiSession.FindById <GuiCTextField>("wnd[0]/usr/ctxtI3-LOW").SetFocus();
     SAPTestHelper.Current.SAPGuiSession.FindById <GuiCTextField>("wnd[0]/usr/ctxtI3-LOW").CaretPosition = 3;
     SAPTestHelper.Current.SAPGuiSession.FindById <GuiButton>("wnd[0]/tbar[1]/btn[8]").Press();
 }