1

When using WinAppDriver I'm receiving an unknown error when trying to sendkeys to the new email window.

I've created a new session to interact with this new window that appears when you click New E-mail. IT looks as though the element is correct as when I use. click() then the test will pass but when I try and sendkeys it fails

        capabilities.setCapability("app", "Root");
        driver = new WindowsDriver(new URL("http://127.0.0.1:4723"),capabilities );
        driver.switchTo().activeElement();

        driver.findElementByName("Page 1 content").sendKeys("PLEASE WORK!");

This is how I create a new session to interact with the new window that appears.

Command duration or timeout: 0 milliseconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'WVA01000004', ip: '10.200.153.43', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_212'
Driver info: io.appium.java_client.windows.WindowsDriver
Capabilities {app: Root, javascriptEnabled: true, platform: WINDOWS, platformName: WINDOWS}

Below is the output from WinAppdriver

==========================================
POST /session/4DC77131-E38D-4661-8544-B3A251D81D11/element HTTP/1.1
Accept-Encoding: gzip
Connection: Keep-Alive
Content-Length: 50
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.59 (java windows)

{
  "using": "name",
  "value": "Page 1 content"
}

HTTP/1.1 200 OK
Content-Length: 99
Content-Type: application/json

{"sessionId":"4DC77131-E38D-4661-8544-B3A251D81D11","status":0,"value":{"ELEMENT":"42.787774.4.2"}}

==========================================
POST /session/4DC77131-E38D-4661-8544-B3A251D81D11/element/42.787774.4.2/value HTTP/1.1
Accept-Encoding: gzip
Connection: Keep-Alive
Content-Length: 64
Content-Type: application/json; charset=utf-8
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.59 (java windows)

{
  "id": "42.787774.4.2",
  "value": [
    "PLEASE WORK!"
  ]
}

HTTP/1.1 500 Internal Error
Content-Length: 133
Content-Type: application/json

{"status":13,"value":{"error":"unknown error","message":"An unknown error occurred in the remote end while processing the command."}}

==========================================
DELETE /session/B4509E36-58DB-4E5A-BF02-F4143656262C HTTP/1.1
Accept-Encoding: gzip
Connection: Keep-Alive
Content-Length: 0
Host: 127.0.0.1:4723
User-Agent: selenium/3.141.59 (java windows)



HTTP/1.1 200 OK
Content-Length: 12
Content-Type: application/json

{"status":0}

I did read that someone else managed to get it working using switchTo().activeElement() but that didn't work for me.

Saqib
  • 23
  • 4
  • Did you check if your windappdriver session created a new windowhandle for the new window? If it does, your problem will most likely be similar to the problem and solution described [here](https://github.com/microsoft/WinAppDriver/wiki/Frequently-Asked-Questions#what-to-do-when-an-application-has-a-splash-screen-or-winappdriver-fails-to-recognize-the-correct-window). – PixelPlex Aug 06 '19 at 12:30
  • Hello, yes I did check the windows session handle. I raised the issue with WinAppDriver devs and it has been raised as a bug (https://github.com/microsoft/WinAppDriver/issues/775). The current workaround is to use Actions to sendkeys. – Saqib Aug 13 '19 at 14:12

1 Answers1

1

The issue mentioned has been raised as a bug on WinAppDriver (https://github.com/microsoft/WinAppDriver/issues/775) but there is a workaround to the issue. Which is to use Actions, below is the code I used to get me past the issue.

    WebElement emailAddressInput = driver.findElementByName("To");
    WebElement subjectInput = driver.findElementByAccessibilityId("4100");
    WebElement locationInput = driver.findElementByAccessibilityId("4102");
    WebElement calendarBodyInput = driver.findElementByAccessibilityId("Body");

    Actions performAct = new Actions(driver);
    performAct.sendKeys(emailAddressInput, toText).build().perform();
    performAct.sendKeys(subjectInput, subjectText).build().perform();
    performAct.sendKeys(locationInput, locationText).build().perform();
    performAct.sendKeys(calendarBodyInput, bodyText).build().perform();
Saqib
  • 23
  • 4