WinAppDriver
WinAppDriver copied to clipboard
Unable to pass values using SendKeys() while automating desktop application using WinAppDriver
I am unable to send values to input field of desktop application. Say for example, in Notepad, on Ctrl+F, 'Find Next' pop up appears. I couldn't send values to the Find Next: input field using sendKeys method. I am able to send values to the text editor of notepad though. I am trying to find a solution using SendKeys method.
Below is the code----
(capabilities.setCapability("app", "C:\\Windows\\System32\\notepad.exe");
capabilities.setCapability("platformName","Windows");
capabilities.setCapability("deviceName", "WindowsPC");
notepadSession = new WindowsDriver(new URL("http://127.0.0.1:4723"), capabilities);
notepadSession.findElement(By.name("Text Editor")).sendKeys("Hi there!");
Robot r= new Robot();
r.keyPress(KeyEvent.VK_CONTROL);
r.keyPress(KeyEvent.VK_F);
r.keyRelease(KeyEvent.VK_CONTROL);
r.keyRelease(KeyEvent.VK_F);
Thread.sleep(2000);
notepadSession.findElement(By.name("Find")).findElement("Find what:")).sendKeys("Hi");)
@mcsia Could you please post the WinAppDriver log and error from your test
@Shakevg This line passed without any error. I tried even next step to click on Find Next button. It tried to find the default text 'path' in the text editor. So basically it did not send values to the input field but the line runs without failure Attaching the WinAppDriver log WinApplog.txt
@mcsia I don't know whether you are still facing the problem can you try this:
notepadSession.findElement(By.name("Find")).findElements("Find what:"))[1].sendKeys("Hi");)