I am not able to send key into text box

Here is the page source.

<?xml version="1.0" encoding="UTF-8"?>

@Aleksei : Please find attachment the source code.page source.txt (6.3 KB)

@Aleksei

I tried the given code but it’s still clicking on notification panel. the page is under web view. can you please check is there any issue with web view ? I attached page source in above message. Please advise.

element we are interested in is:
<android.widget.EditText index="0" text="" class="android.widget.EditText" package="com.praktice.android" content-desc="Email" checkable="false" checked="false" clickable="true" enabled="true" focusable="true" focused="false" scrollable="false" long-clickable="false" password="false" selected="false" bounds="[1095,231][2124,396]" resource-id="email-input" instance="0"/>

another try:
WebElement el = driver.findElement(MobileBy.id("email-input")); driver.tap(1, el, 200); // if it correct element keyboard should appear el.sendKeys("test");

@Aleksei

not working…

error -

An element could not be located on the page using the given search parameters. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.31 seconds

any buddy can advise on the problem ? what would be the best approach to deal with web view in the application ?

The only think I can tell you is my current approach with android in webview using ruby client.
In my app I have to login through facebook and I use xpath to fill the form and I do as this way:

def get_authenticator
  if is_android?
    mail_container = find_element(xpath: "//*/android.widget.EditText[1]")
    pass_container = find_element(xpath: "//*/android.widget.EditText[2]")
    return authenticator = {mail: mail_container, pass: pass_container}
  else
    mail_container = wait{find_element(xpath: "//*/UIATextField[1]")}
    pass_container = find_element(xpath: "//*/UIASecureTextField[1]")
    return authenticator = {mail: mail_container, pass: pass_container}
  end
end

def login_facebook_through_webview
  begin
    authenticator = get_authenticator
    authenticator[:mail].send_keys("[email protected]")
    authenticator[:pass].send_keys("password" + "\n")
  rescue
    $stdout.puts colorize("Already authenticated", 36)
  end

  #Authorize app in FB
  wait(timeout: 35){buttons('OK').last.click}
end

and used it calling:
login_facebook_through_webview

PD: Using appium server 1.5.3 and ruby lib 8.0.2

from the screenshot what I see is. The co-ordinates of the Email Text field is [0,0][0,0] that is why it clicking on the notification panel…

Try to re-capture the view properly. If this comes again n again then inbuild API’s are not going to work.

@teuser_ustest

try also in case with full package name:

WebElement el = driver.findElement(MobileBy.id(“com.praktice.android:id/email-input”));
driver.tap(1, el, 200); // if it correct element keyboard should appear
el.sendKeys(“test”);

no more ideas…

@jay_papai

I recaptured , this time it showing correct coordinate.

@Aleksei -

not working. not sure what the issue with webview.

What is the issue you are facing now?? Can u just put your one line code which you are using for sendText now

@jay_papai

Problem - I tried to insert element in Email field. but it doesn’t get insert. it always clicking on notification panel. Please check the video mention below.

video - http://www.screencast.com/t/EJFaXGM0o

I used the correct id , xpath , name etc. but it always clicks on notification panel.

ex : driver.findElement(By.name(“Email”)).sendKeys(“2”);

The application have webview and it is not able to click on child elements. Please check.

I think I faced the same issue earlier. This is Emulator problem as far I know. Can you run the same on some physical device & check once…

You can try to use setKeys - > check this post: How to use .setText from AppiumDriver instead of .sendKeys from WendDriver or AndroidDriver?

Why not switching to webview context and perform the action.
Is there any reason issue you don’t want to switch context???

@pr4bh4sh

i switched the context too but it was not working

@teuser_ustest

First perform tap action on email field and then perform sendKeys action.

Thanks !!

anybody have idea how to automate cordova (hybrid) app using appium ? I am trying to do it , The element is visible to appium but it is not clicking on it. not sure what is the best approach to automate cordova hybrid app using appium ?

@teuser_ustest By.xpath("//android.widget.EditText[@index=‘0’]"))