Hi there !
Is there a way to get and set the focused element (without clicking or sending keys to it)?
I’m currently testing an app where clicking or sending keys to a TextField open a new window, so I’m using driver.getKeyboard().sendKeys() to write in the focused text field, and driver.pressKeyCode(AndroidKeyCode.KEYCODE_TAB) to navigate between text fields, but I need to do a specific case for each view, which is very tedious.
I’ve tried action.moveTo(textFieldToFocus).perform(), textFieldToFocus.sendKeys("") to set the focus, but it doesn’t work.
I’ve also tried to get the focused element by doing textFieldToFocus.equals(driver.switchTo().activeElement()), but it throws an exception “Method not yet implemented”.
Does someone have a solution?