Confused betwen Java AWT Robot & Selenium Actions

0 votes
To perform mouse/keyboard actions, I've always Selenium Actions() library. But recently I learnt that Java AWT Robot class is also used for the same process. Which of them is a better option? And how different are they, if at all there are any differences wrt to corner-cases, restrictions, stability & performance?
Apr 6, 2018 in Selenium by Martin
• 4,220 points
1,260 views

1 answer to this question.

0 votes
There are plenty of differences between the two. Selenium uses WebDriver API and sends commands to browser driver to perform actions (through the "JSON wire protocol"). However,

Java AWT Robot uses native system events to control keyboard and mouse operations. If your aim is, browser automation, then technically you don't need to use Robot framework because the functionality provided by Selenium Actions() is more than enough. But ofcourse, there are cases when browser or native OS popup comes up like uploading/ downloading a file. This can be also be solved using Robot frameowrk- though generally there are selenium-specific solutions/workarounds that can help avoiding using Robot. The key idea of these workarounds is "since we cannot control the popups, just don't let them open".

For instance, while downloading a file in Firefox, you will get a popup asking you to choose a location and filename where it should get saved. This kinda situation cannot be manipulated using selenium. But, however what you can do, is let Firefox know for certain file types, where to save the downloads automatically, without handling the popup.
answered Apr 6, 2018 by nsv999
• 5,090 points

Related Questions In Selenium

0 votes
1 answer

Selecting an item from dropdown list using Selenium WebDriver & java

Use the below code: new Select(driver.findElement(By.id("blood-group"))).selectByVisibleText("AB"); You also need ...READ MORE

answered May 8, 2018 in Selenium by Meci Matt
• 9,420 points
2,252 views
0 votes
1 answer

How to handle drop downs using Selenium WebDriver in Java

First, find an XPath which will return ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,090 points
2,158 views
0 votes
1 answer

Selenium + Java - drag and drop not working on selenium 3.8

How about you try adding the below ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,090 points
1,559 views
0 votes
1 answer

Need to perform parallel execution (multiple browser sessions) with Selenium & TestNG by using @BeforeSuite

@Beforesuite annotated method runs before the testNG.XML ...READ MORE

answered Mar 30, 2018 in Selenium by nsv999
• 5,090 points
1,462 views
0 votes
1 answer

Installing Selenium Webdriver with Python package

Hey Hemant, for installing Selenium Webdriver with ...READ MORE

answered May 8 in Selenium by Anvi
• 13,400 points
171 views
0 votes
1 answer

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,090 points
767 views
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers

Python & Selenium: How to find and click on YouTube's Like button

Hello Nitin, as the Like button on ...READ MORE

answered Aug 23 in Selenium by Abha
• 24,940 points
637 views