octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.37k stars 961 forks source link

Robotjs does not click on ESCAPE in a Selenium Webdriver e2 test #585

Open TatyanaMartynyuk opened 4 years ago

TatyanaMartynyuk commented 4 years ago

I want to use Robotjs to click on ESCAPE on the keyboard, when Selenium Webdriver opens Upload an image dialog from a web browser.

Expected Behavior

Based on the documentation, it should work with

const robot = require('robotjs');
robot.keyTap('escape');

Current Behavior

I think I'm missing something while using Robotjs, because it does not click on ESCAPE.

Steps to Reproduce (for bugs)

  1. Initialize Robotjs const robot = require('robotjs');
  2. Use Selenium Webdriver to go to a website and click on the button to trigger Upload an image window
  3. Use Robotjs to click on ESCAPE button on the keyboard in order to close the window and continue with Selenium Webdriver
const uploadButton = await driver.findElement(By.id('capture'));
uploadButton.click();
robot.keyTap('escape');
await driver.findElement(By.id('nextButton').click();

Context

I want to use Robotjs in my e2e tests, in cases where Selenium Webdriver has no power to proceed.

Your Environment

vhooz commented 2 years ago

I'm trying to do the same operation, I need to close the windows OS file selector window, but it is not working.