I am not able to send key into text box

Hi ,

I am do not able to insert text into text box. Please check the screenshot link below for all details.

driver.findElement(By.name(“Email”)).sendkeys(“22”);

any buddy , Please help me.

driver.findElement(By.className("android.widget.EditText")).sendKeys("Test");

I tried its not working for me. Please have a look on video -

1.driver.findElement(By.name(“Email”)).sendKeys(“Any value”);
2.
driver.findElementByXPath(“/android.widget.EditText[@content-desc=‘Any Value’]”);

all tried all methods but its not working. when ever i tried to insert text or click on text field it does get automatically click on notification panel.

Please check the video for all details. I am not sure why it is click on notification panel instead of Email field or screen element.

Please do advise.

I use the ruby client which has a method textfield("Email") search for the equivalent.

PD: Did u tried with higher index? (1 i guess, maybe 2)

Yes , tried. not working for me. Problem is its every time clicks on notification panel instead of Email field.

Try to find the element by text “Email”
It could also be helpful to navigate through the appium GUI tool

try following:

WebElement el = driver.findElement(By.className(“android.widget.EditText”));
driver.tap(1, el, 200); // if it correct element keyboard should appear
el.sendKeys(“test”);

Also give us:
driver.getPageSource() result to see it structure

not working… for me

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…