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,320 points
5,923 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,500 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,460 points
5,786 views
+1 vote
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,500 points
8,357 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 28, 2018 in Selenium by nsv999
• 5,500 points
5,145 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,500 points
6,049 views
0 votes
1 answer

Installing Selenium Webdriver with Python package

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

answered May 8, 2019 in Selenium by Anvi
• 14,150 points
15,837 views
0 votes
2 answers

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,500 points
13,673 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
9,142 views
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, 2019 in Selenium by Abha
• 28,140 points
5,442 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP