Robot Class is used in Selenium because, in certain Selenium automation tests, users need control over keyboard or mouse to interact with OS windows like download pop-ups, print pop-ups, etc. and native applications like notepad, calculator, etc. Selenium Webdriver cannot handle these pop-ups/applications, so in Java version 1.3, robot class was introduced which can handle OS pop-ups/applications.
Benefits of Robot Class
Robot Class can simulate Keyboard and Mouse Event
Robot Class can help in upload/download of files when using selenium web driver
Robot Class can easily be integrated with current automation framework (keyword, data-driven or hybrid)
Disadvantages of Robot Class
Robot framwork has few disadvantages mentioned below:
Keyboard/mouse event will only works on current instance of Window. E.g. suppose a code is performing any robot class event, and during the code execution user has moved to some other screen then keyword/mouse event will occur on that screen.
Most of the methods like mouseMove is screen resolution dependent so there might be a chance that code working on one machine might not work on other
Watch video Robot Class in Selenium WebDriver(Java)|| Upload File Using Robot Class online without registration, duration hours minute second in high quality. This video was added by user Programming with Pallavi 19 July 2023, don't forget to share it with your friends and acquaintances, it has been viewed on our site 139 once and liked it 1 people.