I’m trying to insert the code sent to my email using automation.
the code will be added on android.view.view element and when I got the view and used sendKey function it doesn’t work.
I touched the screen then started writing the code using action class by the following piece of code:
tap.addAction(finger.createPointerMove(Duration.ofMillis(0), PointerInput.Origin.viewport(), centerX, centerY));
tap.addAction(finger.createPointerDown(PointerInput.MouseButton.LEFT.asArg()));
tap.addAction(finger.createPointerUp(PointerInput.MouseButton.LEFT.asArg()));
driver.perform(List.of(tap));
Actions action=new Actions(driver);
String code = custAPIs.getCode(apiUrl, userID);
action.sendKeys(code).perform();
I found the code added on the screen successfully but the code updated in the element content-desc by the following way:
How as user you type here numbers?
I guess you need first show keyboard with tap on first left square. After that keyboard will be shown and you type there your numbers. If it correct just do same. Tap on first square and send your six numbers to keyboard.
This is what I actually did by the piece of code that touch the screen as it touches the first left square then the keyboard appears and I start writing the code using action class but I found that the value sent to the view content-desc attribute with the following representation “7
4
6
0
2
6”.
unfortunately, I don’t have text field for each square to send the code to it. the squares are just design of the view element which recieves the code.
I can’t use method #2 as I don’t know the keys I will press previously as I get them on runtime using a method.
so can you help me with any recommendation to solve this issue?