Jump to content

Recording the Test cases


Syed23
 Share

Recommended Posts

Hi Friends,

I would like to automate the application testing through mouse movement.s But where it is not consistent. i need to make it as consistent. can some one help me out on this? for your reference i have attached the scrit below. please have a look.

#region --- ScriptWriter generated code Start ---

Opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Start","")

If Not WinActive("Start","") Then WinActivate("Start","")

WinWaitActive("Start","")

MouseMove(20,23)

MouseDown("left")

MouseUp("left")

WinWait("Start menu","")

If Not WinActive("Start menu","") Then WinActivate("Start menu","")

WinWaitActive("Start menu","")

MouseMove(53,641)

MouseDown("left")

MouseUp("left")

MouseMove(70,571)

MouseDown("left")

MouseUp("left")

MouseMove(74,589)

MouseDown("left")

MouseUp("left")

WinWait("Document1 - Microsoft Word","")

If Not WinActive("Document1 - Microsoft Word","") Then WinActivate("Document1 - Microsoft Word","")

WinWaitActive("Document1 - Microsoft Word","")

MouseClick("left",214,8,2)

MouseMove(625,382)

MouseDown("left")

MouseUp("left")

Send("this{SPACE}is{SPACE}a{SPACE}test{SPACE}x{BACKSPACE}script{SPACE}for{SPACE}automating{SPACE}the{SPACE}word{SPACE}document.{SHIFTDOWN}{SHIFTUP}{SHIFTDOWN}{HOME}{SHIFTUP}{CTRLDOWN}bui{CTRLUP}{CTRLDOWN}{SHIFTDOWN}a{SHIFTUP}{CTRLUP}{CTRLDOWN}{SHIFTDOWN}a{SHIFTUP}{CTRLUP}")

MouseMove(351,106)

MouseDown("left")

MouseMove(349,153)

MouseUp("left")

WinWait("classname=Net UI Tool Window","")

If Not WinActive("classname=Net UI Tool Window","") Then WinActivate("classname=Net UI Tool Window","")

WinWaitActive("classname=Net UI Tool Window","")

MouseMove(79,35)

MouseDown("left")

MouseUp("left")

WinWait("Document1 - Microsoft Word","")

If Not WinActive("Document1 - Microsoft Word","") Then WinActivate("Document1 - Microsoft Word","")

WinWaitActive("Document1 - Microsoft Word","")

MouseMove(298,70)

MouseDown("left")

MouseUp("left")

MouseMove(279,259)

MouseDown("left")

MouseUp("left")

MouseMove(316,76)

MouseDown("left")

MouseUp("left")

MouseMove(467,102)

MouseDown("left")

MouseUp("left")

MouseMove(487,106)

MouseDown("left")

MouseUp("left")

MouseMove(508,110)

MouseDown("left")

MouseMove(509,110)

MouseUp("left")

MouseMove(448,114)

MouseDown("left")

MouseUp("left")

MouseMove(554,103)

MouseDown("left")

MouseUp("left")

WinWait("classname=Net UI Tool Window","")

If Not WinActive("classname=Net UI Tool Window","") Then WinActivate("classname=Net UI Tool Window","")

WinWaitActive("classname=Net UI Tool Window","")

MouseMove(47,66)

MouseDown("left")

MouseUp("left")

WinWait("Document1 - Microsoft Word","")

If Not WinActive("Document1 - Microsoft Word","") Then WinActivate("Document1 - Microsoft Word","")

WinWaitActive("Document1 - Microsoft Word","")

MouseMove(601,108)

MouseDown("left")

MouseUp("left")

WinWait("classname=Net UI Tool Window","")

If Not WinActive("classname=Net UI Tool Window","") Then WinActivate("classname=Net UI Tool Window","")

WinWaitActive("classname=Net UI Tool Window","")

MouseMove(43,65)

MouseDown("left")

MouseUp("left")

WinWait("Document1 - Microsoft Word","")

If Not WinActive("Document1 - Microsoft Word","") Then WinActivate("Document1 - Microsoft Word","")

WinWaitActive("Document1 - Microsoft Word","")

MouseMove(909,90)

MouseDown("left")

MouseUp("left")

MouseMove(713,82)

MouseDown("left")

MouseUp("left")

MouseMove(972,98)

MouseDown("left")

MouseUp("left")

MouseMove(144,44)

MouseDown("left")

MouseMove(145,44)

MouseUp("left")

MouseMove(515,101)

MouseDown("left")

MouseUp("left")

WinWait("Insert Hyperlink","")

If Not WinActive("Insert Hyperlink","") Then WinActivate("Insert Hyperlink","")

WinWaitActive("Insert Hyperlink","")

Send("www.goo{ENTER}")

WinWait("Document1 - Microsoft Word","")

If Not WinActive("Document1 - Microsoft Word","") Then WinActivate("Document1 - Microsoft Word","")

WinWaitActive("Document1 - Microsoft Word","")

Send("{CTRLDOWN}")

Send("MouseMove(572,282)")

MouseDown("left")

MouseMove(573,282)

MouseUp("left")

Send("{CTRLUP}")

WinWait("Google - Windows Internet Explorer","")

If Not WinActive("Google - Windows Internet Explorer","") Then WinActivate("Google - Windows Internet Explorer","")

WinWaitActive("Google - Windows Internet Explorer","")

Send("{ALTDOWN}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ALTUP}")

WinWait("Document1 - Microsoft Word","")

If Not WinActive("Document1 - Microsoft Word","") Then WinActivate("Document1 - Microsoft Word","")

WinWaitActive("Document1 - Microsoft Word","")

MouseMove(910,286)

MouseDown("left")

MouseUp("left")

Send("{ENTER}{ENTER}i{SPACE}am{SPACE}going{SPACE}to{SPACE}save{SPACE}the{SPACE}doucment")

MouseMove(117,49)

MouseDown("left")

MouseUp("left")

Send("{CTRLDOWN}s{CTRLUP}")

WinWait("Save As","")

If Not WinActive("Save As","") Then WinActivate("Save As","")

WinWaitActive("Save As","")

MouseMove(97,179)

MouseDown("left")

MouseUp("left")

MouseMove(621,594)

MouseDown("left")

MouseUp("left")

WinWait("This is a test script for automating the word document.docx - Microsoft Word","")

If Not WinActive("This is a test script for automating the word document.docx - Microsoft Word","") Then WinActivate("This is a test script for automating the word document.docx - Microsoft Word","")

WinWaitActive("This is a test script for automating the word document.docx - Microsoft Word","")

MouseMove(1589,12)

MouseDown("left")

MouseUp("left")

;#endregion --- ScriptWriter generated code End ---

Syed Ibrahim.

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

Learn to use the VBA scripting language built into the Office apps like Word, and/or the COM interface available to AutoIt, i.e. the Word.au3 UDF.

Scripting blind mouse movement is inherently unreliable and you can't change that fact.

;)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...