Selenium Framework for Beginners 33 | What is AutoIT | How to use AutoIT with Selenium

Selenium Framework for Beginners 33 | What is AutoIT | How to use AutoIT with Selenium


Selenium Framework for Beginners 33 | What is AutoIT | How to use AutoIT with Selenium

Free Courses - https://automationstepbystep.com/
Hi, I am Raghav and Today we will learn
What is a AutoIT
Why to use AutoIT
How to use AutoIT with Selenium

helpful tips

What is AutoIT

Software designed for automating windows GUI

Uses a combination of simulated keystrokes, mouse movement and window/control manipulation to automate tasks not possible using only Selenium

An AutoIt automation script can be converted into a compressed, stand-alone executable

AutoIT is Free
Works on Windows


Why to use AutoIT

Selenium cannot handle any non-browser / non-HTML elements

To handle such elements like:
Windows authentication box
File upload dialog box
Any other non-browser interaction

How to use AutoIT with Selenium

Step 1
Download and install AutoIT
https://www.autoitscript.com/site/aut

Step 2
Download AutoIT Script Editor (SciTE)
https://www.autoitscript.com/site/aut

Step 3
Open Au3Info.exe and locate objects on the windows GUI

Step 4
Create AutoIT Script and Test

Step 5
Call AutoIT script in Selenium Test
Runtime.getRuntime().exec(“location of autoit exe”);


helpful tips

Use AutoIT Help application

Refer AutoIT Docs
https://www.autoitscript.com/autoit3/

Project link - https://github.com/Raghav-Pal/Seleniu

PLAYLISTS

SELENIUM JAVA FRAMEWORK BEGINNERS
   • Selenium Java Framework for Beginners  

KATALON STUDIO
   • Katalon Studio  

SELENIUM BEGINNERS
   • Selenium Beginner Tutorial  

SELENIUM TIPS
   • Selenium Tips  

SELENIUM PYTHON
   • Selenium Python  

SELENIUM BUILDER
   • Selenium Builder  

JAVA
   • Java  

JAVA TIPS \u0026 TRICKS
   • Java Tips and Tricks  

JENKINS
   • Jenkins  

JENKINS TIPS \u0026 TRICKS
   • Jenkins Tips n Tricks  

JMETER BEGINNER
   • JMeter Beginner  

JMETER INTERMEDIATE
   • Jmeter Intermediate  

JMETER ADVANCED
   • JMeter Advanced  

JMETER TIPS \u0026 TRICKS
   • JMeter Tips n Tricks  

SOAPUI
   • SoapUI  

POSTMAN
   • Postman Beginner Tutorial  

GIT \u0026 GITHUB
   • Git and GitHub  

DOCKER
   • Docker  

ROBOT FRAMEWORK
   • Robot Framework Beginner Tutorial  

WEB SERVICES (API)
   • API Web Services  

REDIS BEGINNER TUTORIALS
   • Redis Beginner Tutorials  

MAVEN
   • Maven  

MISC
   • Misc Tutorials  

TOOLS \u0026 TIPS
   • Tools and Tips  

QnA FRIDAY
   • QnA Friday  

SUNDAY SPECIAL
   • Sunday Special  

ALL PLAYLISTS
   / @raghavpal  

Like on FACEBOOK :
https://www.facebook.com/automationst

Follow on TWITTER:
https://twitter.com/automationsbs

Subscribe on YOUTUBE :
   / automationstepbystep  

_______ ONLINE COURSES TO LEARN _______

https://automationstepbystep.com/

Never Stop Learning
Raghav


Content

0.93 -> Hello and welcome to this session I am Raghav and today we will learn Auto IT from scratch
6.83 -> and we will go very basic step-by-step and learn what is auto it why to use Auto it?
13.81 -> and how can you use Auto IT with your selenium scripts towards the end of the session I will
19.12 -> also discuss some useful tips with you So let's get started and let us first see what
24.5 -> is Auto IT So Auto IT is automation tool which is used for automating The windows GUI so
31.96 -> selenium, you can use only for browsers or HTML components the browser, then we can use
42.079 -> some other tools and Auto IT is one of them and it uses a combination of keystrokes Mouse
48.11 -> movements and windows control manipulation to automate the task, which is not possible
52.75 -> using only selenium So in Auto IT we can write a script which can be converted into a compressed
58.329 -> Standalone exe file This is something that we can use and call from our selenium scripts
64.57 -> and auto IT is a freeware and it works on windows So if I go to my browser and I will
70.86 -> go to Google and let us search for auto ID here I will say Auto IT and if I go to the
82.17 -> official website of Auto IT, let us see what does it says So this is the official website
87.9 -> www.autoidscripts.com and here you can see it says Auto IT v3 which is the latest version
96.08 -> is a freeware basic like scripting language design for automating the windows GUI and
101.06 -> general scripting Okay So this is what Auto ID is in very simple way and why do we need
106.85 -> to use it as I discussed selenium cannot handle anything which is outside the browser So any
111.95 -> non browser or non HTML elements, we cannot handle with selenium So in your Automation
117.2 -> in real world, you will encounter situations where you have to do a file upload and something
124.09 -> like you have to interact with the windows authentication box or any other non browser
128.92 -> interaction in those situation selenium will not help and you will need to get help from
133.459 -> an external tool and Auto ID is one of them So this is why we need Auto id and now let
138.97 -> us see how to use Auto ID with selenium in five simple steps the very first step is we
144.459 -> have to download and install Auto ID from the auto ID website So I will go here This
150.53 -> is the is auto IT website and here if you go to the main website here Auto IT, if you
157.34 -> go to this drop-down you will find downloads here click on downloads and here if you go
165.189 -> a little more down You will find the current version So as of now, the current version
171.379 -> is 3.3.14.5 and here you can get Auto IT software from here So download it from here So it will
180.709 -> start download I'm canceling the download because I have already downloaded it and let
185.249 -> me just show you if I go to my downloads folder I have this downloaded here and I will now
193.239 -> install it so you can download and then you can click on the exe which will start the
199.87 -> installation and say run Let me minimize other windows So this will start the installation
210.34 -> wizard for Auto IT say next and read and accept the license and then again, it will give you
218.519 -> the recommendation So in case you are using 64 or some other 32-bit version of Windows
226.379 -> 8 will accordingly recommend the best for you So say next here and keep it by default
232.879 -> say next and next and install so it will by default go to program files so this will install
241.089 -> auto IT and let us just wait for the installation to complete It is done and say finish So it
253.599 -> will open this help guide and I will tell you about this in a moment for from now Let
259.28 -> me first take you to the installation folder So it has installed here in C program files
266.68 -> x86 and here you can see the auto IT folder So it has installed here So we are done with
271.62 -> step number one, which is download and install auto IT The second step is we have to download
276.71 -> or to it script editor which is City and then we have to install it So this is a Editor
283.371 -> for writing Auto IT scripts And again, if you go to the auto it website, if you go little
289.55 -> more down you will see this Auto IT script editor SecTi and you can download the editor
295.379 -> here click on download editor and here you will get this page and here you can download
301.11 -> the editor so you can go a little more down and you will get the latest current version
305.949 -> here and you can download the exe file again in my case I have already downloaded it So
310.94 -> let me just show you in my downloads folder I have this SciTE4auto it exe And I will again
316.349 -> install it I will click on the exe file and it will start the installation wizard.
322.49 -> I will say run Next read and agree to the license agreement and this will start the
331.53 -> installation for the Auto ID editor, which is SecTi and finish And again, if you go to
337.47 -> your auto it folder, which should be in C program files and in my case, it is installed
343.46 -> in C program files x86 If you go to auto it, you will find your Secti folder also here
351.24 -> so we are done with the first two steps Let us see Third step is we have to open Au3Info.exe
358.71 -> and So this is kind of an object finder and you will find this in your auto IT folder
365.58 -> You will find this au3 info. exe So if I click here, let us see what happens so you can see
370.969 -> we have got this window and this is a finder tool so you can use this finder tool here
377.99 -> and you can drag to anything on your windows and it will identify it So for example if
382.789 -> I have opened this Particular window if I click here If I drag this finder tool you
389.8 -> can see it is highlighting different objects So if I go and leave it here, you can see
395.78 -> the title is desktop The class is cabin 8w class and here you can see the class and instance
402.159 -> and then here you can see the other properties Windows control visible text hidden text and
409.689 -> so on so you will get different properties and using these properties we can create a
414.22 -> script to interact with all these windows elements.
417.999 -> So now we have to create a selenium script where we can use this Auto IT scripts so let
424.79 -> us take an example I will go to a sample website called let us say I will go to Tiny upload
431.55 -> This is a sample website for a demo on upload So this is Tiny upload.com and here you can
440.4 -> see we can click on this choose file and it will open this window and this is something
448.31 -> that selenium is incapable of interacting with so this window to select a file to select
454.159 -> a location in and click on open Button This is something we will have to do with Auto
458.3 -> IT So now let us write a script for Auto IT and that is our third step third step We have
463.919 -> done the fourth step is create automatic script and test.
467.349 -> So now I have to open The editor so I will go here Inside my SciiTE folder under Auto
477.819 -> it folder and you will find this SciiTE.exe If you click here It will open the city editor
484.87 -> so you can see the SciiTE editor is here and let me just use this so this is the editor
496.87 -> and now you can write your script here So now there are many commands in Auto it and
503.129 -> I will just tell you how to use the commands I will tell you some useful tips on using
507.809 -> commands in a moment But for now, what we will do is so here you will say we have a
514.699 -> command called control Focus So this is something we can use to focus on an object and then
520.669 -> we have something like control click to click on object then we have Roll set text to set
528.32 -> a text into a text box or any object So this is what we will be using and for that first
535.48 -> Let me identify the object that I have to work on So this is the window and the very
541.81 -> first thing I have to focus on this file name this text box where I will be adding the location
547.57 -> of my file So I will use this finder window finder tool for auto it Drag this tool to
556.23 -> file name here and leave it and you can see it has given as the title which is open and
562.82 -> the basic control info is edit and instances one and this is what we will be using on our
568.32 -> automatic script So I will go to my city editor and here I will say I have to focus on this
573.61 -> particular object So I will say control focus and it will auto complete and then I will
579.94 -> start the brackets and you can see it is giving us the syntax So the first thing is is title
584.01 -> which is this open, so I will say title is open make sure that you keep it case sensitive
593.19 -> and then we have to give a text here So text is something we can leave we do not need it
599.649 -> as it is not mandatory And then we have to give a control ID now control ID You can take
603.94 -> it from here So whatever you get in the basic control info you can use the class along with
610.14 -> the instance So this is edit one So I will say control ID here is at it one and that's
619.56 -> it So I will close the bracket So this is the very first statement So this will get
626.36 -> our focus on this particular file Name text box and now we have to write the location
632.14 -> of our file which we have to upload So the next command I will use is Control set text
642.029 -> and again, I will have to give the title So this is the same object which is open and
648.68 -> then text we can leave blank and control ID is added one and then I have to give the location
659.079 -> so for that let me go to my D drive and I will select some files from here Let me say
667.79 -> this document 1.PDF or I can also create a new file I will just create a text file here
673.5 -> I will say this is file 1.txt And I will copy the location which is d file one.txt this
689.23 -> I have to give here So I will paste it here and that's it I will close the bracket So
697.199 -> this is our second command And the third command is we have to click on the open button So
702.519 -> now I have to identify the open Button which is from here this open button So I will again
710.73 -> go to my finder tool and drag it over the open button and you can see the properties
716.69 -> have changed and I will leave it and you can see the properties title is open and classes
722.209 -> button And we can use button 1 so I will again go to my editor and say now I will say control
731.22 -> I have to click the right So I will say control-click bracket open title is open Text we can leave
741.3 -> blank and control ID is button one so you can see the control here button one and that's
750.589 -> it So our script is done I will save it so you can save it click on here save or press
757.92 -> Ctrl spacebar on your keyboard and I will save on my D drive so you can see the file
761.92 -> type should be Auto it or the extension is AU3 So by default it will take it and otherwise
769.829 -> can manually give the extension au3 and I will say this is file upload script and Save
782.47 -> And if I go to the location and let us see this is our file upload script for Auto ID
787.92 -> with the extension .au3 and now we have to compile it So if you now right click on this
793.38 -> file, you will find the option compile step You will also find compiled script x 64 x
799.29 -> 86 So you can use any of them as per your operating system You can use compiled script
803.66 -> here as well So here or I'm on Windows 64 also just for your information if you want
810.42 -> to see the bit size of your operating system You can do a right click on my computer this
815.079 -> PC go to properties and here you will find the bit size You can see in my case It is
820.829 -> 64 bit So I will now Right-click and I will say compiled script x 64 and it will create
835.149 -> an exe file So you see this it has created a exe file And this is now an executable file
840.959 -> that I can use Also The other thing that you can do now is if you do a right click on the
846.529 -> auto it script with the date AU3 extension which is this one and if you right click and
853.06 -> say edit script it will again open in the script editor and here if you go to tools
859.79 -> you will And all these options to compile to test run so we can actually run this also
864.379 -> and let me show you to let me show you this running and to see this running
868.92 -> I will also add some sleep statement so that you can see this running properly I will add
874.7 -> a delay of 3,000 milliseconds which is equal to 3 seconds and I will copy this and paste
883.36 -> it after this action as well and now I can run this and to show you running Let me just
890.839 -> close all these windows and here they can also close this and I will split my screen
905.98 -> So that you can see this running So let's just split my screen here Okay, so
919.459 -> this is my script and this is the window where it will do the action So this is the window
924.199 -> So I will do a I will go to tools and I will say test run and you will see what happens
930.67 -> So it focuses here and then it will add the location which is D file1.txt You can see
935.459 -> here and it will click on open and you can see it has come here file1.txt So our script
941.48 -> is running fine And now I can use this EXE file into my selenium script and to do that
950.779 -> I will open my Eclipse here and go to my project and here I will create a new class and here
960.62 -> the last step is callout Auto IT script in selenium tests, which we are going to do now
965.97 -> so you can create a new class or in the existing class as well You can do it I am showing you
970.569 -> a demo now So in the demo folder, I will create a new class right click new.
977.45 -> Class and I will name it as Auto it demo And we have got a class and I will create a function
988.61 -> here public static void test And here I will say Webdriver Java equals new chrome driver,
1007.98 -> so I'm initializing a chrome driver here And let me autocomplete this yes chromedriver
1014.85 -> from ORG openqa selenium and I also have to give the location of my chrome driver exe.
1022.18 -> So let me take this from an earlier script just to save some time So this is the location
1027.55 -> I will just copy this and paste it here.
1031.62 -> So all this we have done our earlier session So I am not going into detail I'm just setting
1035.29 -> the property Webdriver.chromedriver do the location wherever my chromedriver.exe is and
1041.3 -> then I'm initializing web driver driver equals new chromedriver I will have to import Webdriver
1046.4 -> from org openqa selenium and now I can use driver I will say driver.get and I have to
1052.71 -> go to the URL which is this one tiny upload.com So let me just copy it from here Tiny upload.com
1062.28 -> and I will go here and here now I have to After going here, I have to click on this
1073.01 -> button choose file So I will see what is the locator of this file I will right click go
1078.32 -> to inspect and here I can see the name is uploaded file So I will use this locator name
1086.76 -> so I will say driver.find element by.name And the name is uploaded file and I will say
1100.82 -> .click this should be click Yes, and after I click here So after I will click here, I
1109.37 -> will get this window and then here we have to call our Auto IT script So the syntax is
1115.71 -> you can use the class runtime.get runtime and Dot exe exe C and then the location of
1122.7 -> your Auto IT exe file, so I will say here so the runtime is a class and .Get runtime.exec
1138 -> and the string command and so the string command is our location of our Auto it file which
1144.28 -> is located here This is the file so I will copy this location I will say File upload
1155.25 -> script.exe So this is the location I will copy this from here and give it in my script
1166.34 -> here And I will have to import this or I will have to add through stimulation so I can either
1174.13 -> surround with try catch or add a through stimulation here And now you can see this runtime is a
1181.811 -> class If you hover over it, you will see every job application has a single instance of class
1185.71 -> turned time that allows the application to interface with the environment in which the
1190.51 -> application is running and get runtime is a function where we can get the current instance
1195.33 -> of the runtime and We are calling our Auto IT script here And after this I can just say
1204.59 -> I will just pause for some time.
1207.8 -> So I will say Red Dot sleep for 3 seconds and then I can say driver.Close Okay, and
1227.24 -> let me say throws exception so that it handles 3rd Row sleep as well So this is our simple
1232.04 -> code So let us try to run this and for that I will have to add a main method you can also
1237.72 -> use testNG I am using a main method here for now and I will call this test method inside
1243.75 -> the main method and I will also have to throw the exception here So this is fine So let
1251.531 -> us now See I will do a right click run as Java application and let us see what happens
1260.8 -> So it opens the URL tiny upload and now it goes here and it actually did it very fast
1266.44 -> You can see it has already uploaded the file and close the browser.
1270.53 -> So just to see if it did it correctly What I will do is I will not close the browser
1277.06 -> this time What I'm going to do is I will also do a change in the script so I will open this
1283.54 -> Into the editor and this time I am going to select another file so I will create another
1291.19 -> file here File2.txt I will say new file text document File2.txt and I will write something
1307.07 -> here.
1308.13 -> And close it Save and close it And this is what I have to upload So in my auto it script
1318.92 -> I will say this is file2.txt And save it Close it And again, I have to compile it So I will
1328.62 -> do a right click and I will say compiled script So you can see it is again This is the same
1338.35 -> compiled here And now if I use it, let us run our program again I will run this again
1347.84 -> Let us see what happens this time So it opens the Chrome browser goes to Tiny upload.com
1355.57 -> and selects the file file2.txt and clicks on open and you can see a file2.txt here Right?
1364.71 -> And this time I have not closed the browser so that you can see the upload is successful
1368.89 -> It has uploaded it And of course if I click upload now You will find file upload started
1376.63 -> and you can see it here as well So you can download it again from here and if I click
1384.82 -> here you can see file2.txt here Right?
1388.63 -> So this is how you can use Auto it and let us also look at some useful tips So you can
1396.33 -> use the auto it help application and I have shown you this earlier This is the auto it
1401.79 -> help So let me minimize all other applications and show you Auto IT Help So here if you go
1408.85 -> here you can find a lot of information So you have introduction Frequently asked questions
1413.68 -> with this will be very useful You also have using Auto IT, which will have a lot of information
1418.75 -> on how you can use it Auto IT You have tutorials here So my first script hello world and so
1424.9 -> many tutorials here And also if you go to index and search for commands, you will find
1431.59 -> all the commands that we can use so here in this session we used control click and if
1436.72 -> you go here you will find all the details about this we use control Focus if you click
1441.64 -> here you will find And all the details about control Focus.
1444.021 -> So this is very useful and in case you have closed it, you can go back to your location
1449.88 -> where your auto IT was installed and here you will find this Auto it help.exe so you
1456.31 -> can start it from here and then read the documentation The other thing is you can read read the auto
1461.88 -> IT doc and if you go to Google and say Auto it docs You will get a link here documentation
1470.77 -> Auto it if you go here.
1474.6 -> You will see the documentation and this is again a very useful document You will find
1479.47 -> all the documentation and helpful information about Auto it like frequently asked questions
1485.72 -> and history and use and you can see the language reference as well and then you can get some
1491.26 -> function reference So if you click function reference here, you will get all the possible
1496.29 -> function so you can see again control Focus control enable disable, whatever you want
1500.27 -> to use you can search and you can look at the Documentation so these are going to be very
1505.58 -> useful for you So this was all about this session I hope Auto IT is very clear to you
1511.01 -> I will suggest that you do some more Hands-On so that this concept is very clear to you
1515.11 -> and also share your knowledge with others and help everyone I will meet you in the next
1519.28 -> video Thank you so much for watching.

Source: https://www.youtube.com/watch?v=3nPFjfpDwGU