Hi guys, What is correct xpath for input element?
I tried to use
driver.FindElementByClassName(“android.widget.EditText”).SendKeys(“http://test.com”);
and its doesn’t work.
My environment:
I’m using real device, not emulator.
Samsung Galaxy S5 (Android 4.4.4)
Appium 1.4.13.1
C#
this is my capability setup:
DesiredCapabilities cap = new DesiredCapabilities();
cap.SetCapability(“platformversion”, “4.4.4”);
cap.SetCapability(“deviceName”, “Android”);
cap.SetCapability(“browserName”, “selendroid”);
cap.SetCapability(“platformName”, “Android”);
cap.SetCapability(“app”, “C:\Users\george\Desktop\test.apk”);
driver = new TouchCapableRemoteWebDriver(new Uri(“http://127.0.0.1:4723/wd/hub”), cap);
This is issue:
![](//discuss.appium.io/uploads/default/original/2X/7/72f2777e5ad1ea6b760e5660f1b1e204c690c07e.png)
If I’m using emulator the code:
driver.FindElementByClassName(“android.widget.EditText”).SendKeys(“http://test.com”);
will be work, but if I’m trying to run same script with real device it fail for some reason.
You can use the element type in xpath.
Ex: //android.widget.EditText
I’m having the same trouble and even using you xpath suggestion @sandeepshetty I can´t put it to work.
xpath=//android.widget.TextView[@text=‘[email protected]’]
This happens when I try to select something from the webview, also I try to get contexts and I only find NATIVE_APP.
Any ideas about this?
I’m writing tests in robot framework to test a hybrid app on real devices using appium server.
Can you try with: //android.widget.TextView[0] or //android.widget.TextView ? I think you need not put @text as there is only one text field.
Check it in Appium Inspector first.