GYRA is a free Desktop Application Automation testing tool that we have developed to overcome the many challenges and limitations that are present in other tools. With the launch of GYRA, you can say goodbye to tools that have poor reliability, slow execution speeds, complex setup process, no active support, and lack of support for Java & Windows 11. As we have addressed all these major issues, we are confident that you will be able to enhance the quality of your desktop app automation testing.
Getting Started with GYRA:
As promised, GYRA will be an easy tool to use in comparison that has an easy setup and execution process. So make sure to follow the documentation and get a clear understanding of how GYRA works. Let’s start with the prerequisites, and then proceed to the code snippets you will need to know to perform various actions in the tool.
Pre-Requisite:
To use GYRA, you must set up the server and the client library by following a few simple steps that we have mentioned.
Step-1: Download the Gyra Server EXE File and Start the Server exe file.
(By default, the port number will be 3000)
gyra-server-1.0.exe (The default portNumber is 3000)
gyra-server-1.0.exe --port=8208
Step-2: Add this ‘Dependency’ in the Maven project.
<dependency>
<groupId>com.codoid.products</groupId>
<artifactId>gyra-client</artifactId>
<version>1.0</version>
</dependency>
Example:
In this below-mentioned code, we have launched the Notepad application and clicked the ‘File’ option from the menu.
Server server = new Server("localhost", 3000);
//To initialize the Server
server.openApplication("C:\\WINDOWS\\system32\\notepad.exe");
// To launch the Windows application
Desktop desktop = server.getDesktop();
//By using this Server class object, we will take control of the Desktop first and then take control of all the running apps.
Window window = desktop.findWindow(By.name("untitled - Notepad"));
//To find the window using the locator strategy and attach the window session in the window reference object.
window.findElement(By.xpath("//MenuItem[@name='File']")).click();
// Using findElement keyword, to find the particular element and then 'click' action performed.
The different locating strategies in Gyra-client are as follows:
window.findElement(By.name("File"));
window.findElement(By.partialName("Fil"));
window.findElement(By.controlType("MenuItem"));
window.findElement(By.automationId("Item 1"));
window.findElement(By.className("Menu Item1"));
window.findElement(By.xpath("//MenuItem[@name='File']"));
Special Note for Xpath Locators:
S. No | Supported | Not Supported |
1 | //MenuItem[@name=’File’] | //Menu/MenuItem[@name=’File’] |
2 | //Edit[@ClassName=’TextBox’ and @name=’Search’] | /root |
Note: For the above-mentioned Locating technique[By.xpath], we have to be more precise in providing the element location. Because unlike Selenium, traversing through the element is not supported.
Find Elements:
The findElements command takes By object as the parameter and returns a list of windows elements.
Code:
List<Element> hyperLinks = pane.findElements(By.controlType("hyperlink"));
for (Element link : hyperLinks) {
link.click();
}
Code Snippets:
Now let’s take a look at the code snippets that will help you perform keyboard actions, mouse actions, screenshot comparison function, wait functions, and find element properties.
1. Native Events
2. Element Properties
3. Keyboard Actions
4. Mouse Actions
5. Screenshot Comparison Functions
6. Wait Functions
Native Events:
The actions we are about to see differ from the regular keyboard and mouse action commands as they will be performed directly on the Windows Native elements instead of mimicking the actual interaction of the user.
Single Click:
window.findElement(By.xpath("//MenuItem[@name='File']")).click();
Double click:
window.findElement(By.xpath("//MenuItem[@name='File']")).doubleClick();
Mouse Click:
window.findElement(By.xpath("//MenuItem[@name='File']")).mouseClick();
//To place the mouse pointer at the center of the element and perform a click.
Right Click:
window.findElement(By.xpath("//MenuItem[@name='File']")).rightClick();
SendKeys:
Element txtField =window.findElement(By.name("EditUser"));
txtField.sendKeys("Codoidian");
String strField=txtField.getValue();
// It’ll return the Text box value
ComboBox:
To select a particular option from the combobox
//Way-1
Element comboBoxSource=window.findElement(By.xpath("//ComboBox[@name='Source:']"));
ComboBox comboBox = new ComboBox(comboBoxSource);
comboBox.select("Rear Tray");
//Way-2:
Element weekComboBox = window.findElement(By.automationId("firstDayOfWeek"));
ComboBox comboBox = new ComboBox(weekComboBox);
comboBox.expand();
weekComboBox.sendKeys("Monday");
comboBox.collapse();
Toggle:
Element btnToggle = window.findElement(By.automationId("Toggle"));
btnToggle.toggle();
Element Properties:
Element btnLogin = window.findElement(By.automationId("loginId"));
btnLogin.getName();
// To get the visible value for the element
btnLogin.getHelpText();
// Te retrieve the Tooltip
btnLogin.getTop();
btnLogin.getLeft();
btnLogin.getBottom();
btnLogin.getRight();
// You will be able to retrieve the Coordinates
Keyboard Actions:
Keyboard keyboard = desktop.getKeyboard();
// To get complete control of the keyboard
keyboard.sendKeys("{WIN}");
// If you are passing any special key such as shift, alt, ctrl, and so on, make sure to use "Curly braces - {}"
If you want to press more than one key, you can use the below-mentioned pattern,
keyboard.sendKeys("{CTRL}X");
keyboard.sendKeys("{CTRL}{SHIFT}{ALT}S");
Mouse Actions:
Mouse mouse = server.getDesktop().getMouse();
// To get control of the mouse
Mouse Move:
mouse.move(10, 20);
//To move the mouse cursor to the specified X & Y Coordinates.
Click Action:
mouse.move(10, 20);
mouse.click(Keys.LEFT); // Left click
mouse.click(Keys.RIGHT); // Right Click
//To left/right click on the specified X and Y coordinates
Screenshot Comparison Functions:
By comparising the screenshot of the actual image with the expected image, GYRA will be able to give a score that denotes the difference between the actual and expected images. Likewise, GYRA will also be able to deliver a difference image depicting what the change between the two images are as well. So let’s see the code snippets for those functions.
Note: Make sure that the expected image is in the same resolution as the screenshot.
Capture Screenshot:
To capture a screenshot of the entire screen that we will later use to compare.
Example:
byte[] imgByte = server.getDesktop().takeScreenShot();
FileUtils.writeByteArrayToFile(new File("imgEntireScreenshot.png"), imgByte);
Get Difference from the Image Comparison:
This function can be used to compare the screenshot with the expected image and show the difference between the two images as a separate image.
Element msPaintPane = desk.findElement(By.automationId("59648"));
ImageCompareOutput output = msPaintPane.compareScreenShot("report/Expected.png");
FileUtils.writeByteArrayToFile(new File("report/difference.png"), output.getDiffImage());
Get Score from the Image Comparison:
To get the score that denotes the difference between the two images. For example, if the images are a 100% match without any difference, the return value will be 0. If there are any differences, a value greater than 0 will return based on the level of the difference.
double scoreValue=output.getScore();
DecimalFormat formatter = new DecimalFormat("#0.000000");
System.out.println("--- Output Score: "+formatter.format(scoreValue));
Note: The difference score is calculated based on the difference in the RGB values and are highly accurate.
Compare Images:
You can also use GYRA to compare 2 images of your choice to get the difference image and score using the above-mentioned functions (getDiff & getScore).
Code:
ImageCompareOutput output = server.compareImage
("report/Actual.png", "report/Expected2.png");
Get Score from the Image Comparison:
Once the images have been compared, you will be provided with a score that denotes the difference between the actual and expected images. For example, if the images are a 100% match without any difference, the return value will be 0. If there are any differences, a value greater than 0 will return based on the level of the difference.
double scoreValue=output.getScore();
DecimalFormat formatter = new DecimalFormat("#0.000000");
System.out.println("--- Output Score: "+formatter.format(scoreValue));
Compare Image:
You can also use GYRA to compare 2 images of your choice. (Actual & Expected images)
Code:
ImageCompareOutput output = server.compareImage
("report/Actual.png", "report/Expected2.png");
Wait Functions:
Wait functions are very important to automation and you can wait for a window or even wait for an element using the below commands.
Wait for Window:
Window window = desktop.waitForWindow(By.partialName("Notepad"), 15);
Wait for Element:
Element txtAllowance = desktop.waitForElement(By.xpath("//Edit[@AutomationId='AllowancePeriod']"), 15);
Comments(0)
Posted on Nov 28, 2024
1 month ago
One of the key takeaways from the blog is that algorithm testing often goes beyond typical functionality testing. It incorporates aspects like time complexity, edge cases, and stress tests, ensuring that the algorithm handles large inputs or extreme conditions without failing. It also discusses optimizing algorithms for better performance, making sure they deliver results efficiently. The blog includes detailed explanations of stress testing, performance evaluation, and tools that help in assessing algorithmic accuracy and performance under load
Posted on Feb 04, 2024
11 months ago
Every time I visit your site, I leave feeling more knowledgeable.
Posted on Feb 04, 2024
11 months ago
This is one of those articles I'll be coming back to time and again. Incredibly useful.
Posted on Feb 03, 2024
11 months ago
Keep up the fantastic work!
Posted on Nov 15, 2023
1 year ago
My brother suggested I might like this website. He was totally right. This post actually made my day. You cann't imagine just how much time I had spent for this information! Thanks!
Posted on Nov 10, 2023
1 year ago
Pretty! This has been a really wonderful post. Many thanks for providing these details.
Posted on Nov 02, 2023
1 year ago
I am not sure where you're getting your info, but good topic. I needs to spend some time learning much more or understanding more. Thanks for magnificent info I was looking for this information for my mission.
Posted on Oct 16, 2023
1 year ago
The depth of research in your articles is unparalleled.
Posted on Oct 14, 2023
1 year ago
I just like the helpful information you provide in your articles
Posted on Oct 14, 2023
1 year ago
This is really interesting, You’re a very skilled blogger. I’ve joined your feed and look forward to seeking more of your magnificent post. Also, I’ve shared your site in my social networks!
Posted on Oct 14, 2023
1 year ago
This is my first time pay a quick visit at here and i am really happy to read everthing at one place
Posted on Sep 17, 2023
1 year ago
Great information shared.. really enjoyed reading this post thank you author for sharing this post .. appreciated
Posted on Sep 08, 2023
1 year ago
I appreciate the effort you put into creating this content. It's informative and well-written. Nice job!
Posted on Sep 06, 2023
1 year ago
[url=https://mtw.ru/colocation]дата центры москвы[/url] или [url=https://mtw.ru/colocation]colocation цод[/url] https://mtw.ru/colocation хостинг asp
Posted on Sep 05, 2023
1 year ago
Very helpful for beginners
Posted on Aug 24, 2023
1 year ago
Awesome! Its genuinely remarkable post, I have got much clear idea regarding from this post
Posted on Aug 19, 2023
1 year ago
This was beautiful Admin. Thank you for your reflections.
Posted on Aug 12, 2023
1 year ago
Greetings! I've been following your web site for some time now and finally got the bravery to go ahead and give you a shout out from Porter Tx! Just wanted to mention keep up the good job!
Posted on Aug 06, 2023
1 year ago
I like the efforts you have put in this, regards for all the great content.
Posted on Jun 26, 2023
1 year ago
I completely agree with the points discussed in this article. Software testing and quality assurance (QA) are crucial aspects of the software development life cycle. They play a vital role in ensuring the delivery of high-quality products to end-users. Overall, software testing and QA are essential for delivering quality products that meet user expectations. It is crucial for organizations to invest in skilled testing and QA professionals, establish effective processes, and leverage appropriate tools and frameworks to ensure comprehensive software quality. By doing so, companies can gain a competitive edge, build customer trust, and achieve long-term success.
Posted on Jun 15, 2023
1 year ago
I am truly thankful to the owner of this web site who has shared this fantastic piece of writing at at this place.
Posted on Jun 12, 2023
1 year ago
I appreciate you sharing this blog post. Thanks Again. Cool.
Posted on Feb 11, 2023
1 year ago
Thanks for one's marvelous posting! I genuinely enjoyed reading it, you could be a great author.I will be sure to bookmark your blog and will eventually come back in the foreseeable future. I want to encourage you to definitely continue your great job, have a nice holiday weekend!|
Posted on Feb 04, 2023
1 year ago
I am really delighted to glance ɑt this webpage ρⲟsts which caгries lots of valuɑble data, thanks for proѵiding such data.
Posted on Feb 04, 2023
1 year ago
I just like the helpful information you provide in your articles
Posted on Jan 30, 2023
1 year ago
Hi as a writer it's not easy to find relevant articles Google should work this direction. Actually I was looking for some information but I have to check 50 to 60 blogs and I don't remember exact number. This blog I find at 4th page and trust me I was surprised to find such a great article too far. But I would like to say thanks for providing such great information in free without any cost. That's why here I am commenting to give feedback.
Posted on Jan 22, 2023
1 year ago
Нello there, You've done a fantastic job. I'll definitely digg it and pers᧐nally suggest tⲟ my friends. I am cоnfident they will bе Ƅenefited from this site.
Posted on Jan 19, 2023
1 year ago
Thanks for very informative blog, its quite interesting.
Posted on Jan 09, 2023
2 years ago
Hi there, It's really very nice blog. I was here to read this blog and looking to collect some information about ott app development. You have covered all the points. Thanks for sharing.
Posted on Jan 09, 2023
2 years ago
Hi there to all, for the reason that I am genuinely keen of reading this website’s post to be updated on a regular basis. It carries pleasant stuff.
Posted on Jan 08, 2023
2 years ago
Pretty! This has been a really wonderful post. Many thanks for providing these details.
Posted on Jan 05, 2023
2 years ago
I’m often to blogging and I really appreciate your content. The article has actually peaks my interest. I’m going to bookmark your web site and maintain checking for brand-spanking new information.
Posted on Jan 04, 2023
2 years ago
I do not even understand how I ended up here, but I assumed this publish used to be great
Posted on Dec 27, 2022
2 years ago
It’s really a great and helpful piece of information. I am glad that you shared this helpful info with us. Please keep us informed like this. Thank you for sharing.
Posted on Dec 20, 2022
2 years ago
This blog explains the relation between Continuous Testing and Agile Testing very well.
Posted on Dec 05, 2022
2 years ago
I just like the valuable info you provide for your articles. I'll bookmark your weblog and test again right here regularly. I am rather sure I will be informed many new stuff right right here! Good luck for the following!|
Posted on Dec 01, 2022
2 years ago
Excellent article and it covered all the major points along with a short explanation. Is it possible to provide a breakdown for accessibility testing WCAG 2.1 AA?
Posted on Nov 06, 2022
2 years ago
I appreciate you sharing this blog post. Thanks Again. Cool.
Posted on Oct 26, 2022
2 years ago
In it something is. Now all became clear to me, I thank for the information.
Posted on Oct 11, 2022
2 years ago
Pretty! This has been a really wonderful article. Many thanks for supplying this information.
Posted on Sep 25, 2022
2 years ago
Pretty! This was an extremely wonderful post. Thank you for supplying this info.
Posted on Sep 25, 2022
2 years ago
I think this is one of the most significant information for me. And i'm glad reading your article. But want to remark on some general things, The website style is ideal, the articles is really great : D. Good job, cheers
Posted on Sep 24, 2022
2 years ago
An outstanding share! I've just forwarded this onto a co-worker who had been conducting a little research on this. And he in fact ordered me lunch simply because I discovered it for him... lol. So let me reword this.... Thank YOU for the meal!! But yeah, thanx for spending some time to talk about this topic here on your site.
Posted on Sep 22, 2022
2 years ago
I like the valuable information you provide in your articles. I will bookmark your blog and check again here regularly. I'm quite sure I will learn a lot of new stuff right here! Best of luck for the next!
Posted on Sep 21, 2022
2 years ago
This actually answered my downside, thank you!
Posted on Sep 19, 2022
2 years ago
Way cool! Some eҳtгemely valid points! I appreciate you writing this article and tһе rest of the site is also rеally good.
Posted on Jun 16, 2022
2 years ago
You have posted very informative content. Thanks for sharing this quality information. Keep posting like this, and we will return to your website for more of this type of content.
Posted on Mar 16, 2022
2 years ago
#comment-3292 Test Comments troubleshoot failures and we can set up our own distributed execution elegantly.
Posted on Mar 16, 2022
2 years ago
Test Comments troubleshoot failures and we can set up our own distributed execution elegantly.
Posted on Mar 09, 2022
2 years ago
The "Mobile App Testing Checklist" and "Mobile App Testing Tools" sections were quite helpful! I was able to understand it easily. Thank you for providing this insight. Regularly update outstanding blogs like this.
Posted on Mar 07, 2022
2 years ago
This is informative, step by step explanation with the flow helps a lot to understand the clear picture of mobile app testing.
Posted on Feb 22, 2022
2 years ago
Apart from the session creation call, all other requests will be forwarded to Node from Router directly. Each client request has a Session ID. Using the session ID, the Router queries the Node URI and finds the node which holds the session.
Posted on Feb 22, 2022
2 years ago
Test Comments troubleshoot failures and we can set up our own distributed execution elegantly.
Posted on Feb 17, 2022
2 years ago
Comment
Posted on Sep 07, 2020
4 years ago
how to clear all rows and columns except header
Posted on Aug 30, 2020
4 years ago
Nice tool
Posted on Aug 28, 2020
4 years ago
Testing the products comment section
Posted on Aug 28, 2020
4 years ago
Test the product section
Posted on Aug 28, 2020
4 years ago
Test comment reference
Posted on Aug 27, 2020
4 years ago
Thank you for the information regarding WelDree
Posted on Aug 27, 2020
4 years ago
thank you for useful information
Posted on Aug 25, 2020
4 years ago
Testing the comments in test posts.
Posted on Aug 25, 2020
4 years ago
Testing comment section2
Posted on Aug 25, 2020
4 years ago
Testing the test post section using the comments section