Appium send keys not working for IOS

IOS- Appium send keys are not working for Create Account following (Last name, First Name). here including my XML

Appium Version Version 1.6.3 (1.6.3)

Any one has some clue ro help me?

















Can you copy your code and the logs? this dont give any info to help you

Following code is working iPhone X, iPhone 7/8 not working

/**
* First Name field – contains static text elements for First Name* and then static text holding user’s first name entry
*/
@iOSFindBy(xpath = “//XCUIElementTypeCell[@name=‘First Name, Required, Text field’]”)

public MobileElement firstNameField;

/**
 * First Name static text -- contains the First Name* header on the entry field
 */
@iOSFindBy(xpath = "//XCUIElementTypeCell/XCUIElementTypeStaticText[@name='First Name*']")
public MobileElement firstNameStaticText;

/**
 * Last Name field -- contains static text elements for Last Name* and then static text holding user's last name entry
 */
@iOSFindBy(xpath = "//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeTable[1]/XCUIElementTypeCell[3]")
public MobileElement lastNameField;

/**
 * Last Name static text -- contains the Last Name* header on the entry field
 */
@iOSFindBy(xpath = "//XCUIElementTypeCell/XCUIElementTypeStaticText[@name='Last Name*']")
public MobileElement lastNameStaticText;

/**********/
String fName = userInfo.getFirstName();
System.out.println("Setting first name as: " + fName);
//Type the first name into the firstNameField
this.firstNameField.sendKeys(fName);
System.out.println("We think we set the first name as: " + fName);

     //Get the lastName from the userInfo object
     String lName = userInfo.getLastName();
     System.out.println("Setting last name as: " + lName);
     //Enter the lastName into the lastNameField
     this.lastNameField.sendKeys(lName);
     System.out.println("We think we set the last name as: " + lName);
     

     //Get the lastName from the userInfo object
     String lName = userInfo.getLastName();
     System.out.println("Setting last name as: " + lName);
     //Enter the lastName into the lastNameField
     this.lastNameField.sendKeys(lName);
     System.out.println("We think we set the last name as: " + lName);

Following code is working iPhone X, iPhone 7/8 not working

/**

  • First Name field – contains static text elements for First Name* and then static text holding user’s first name entry
    */
    @iOSFindBy(xpath = “//XCUIElementTypeCell[@name=‘First Name, Required, Text field’]”)

public MobileElement firstNameField;

/**

  • First Name static text – contains the First Name* header on the entry field
    /
    @iOSFindBy(xpath = "//XCUIElementTypeCell/XCUIElementTypeStaticText[@name='First Name
    ’]")
    public MobileElement firstNameStaticText;

/**

  • Last Name field – contains static text elements for Last Name* and then static text holding user’s last name entry
    */
    @iOSFindBy(xpath = “//XCUIElementTypeApplication[1]/XCUIElementTypeWindow[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[2]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeOther[1]/XCUIElementTypeTable[1]/XCUIElementTypeCell[3]”)
    public MobileElement lastNameField;

/**

  • Last Name static text – contains the Last Name* header on the entry field
    /
    @iOSFindBy(xpath = "//XCUIElementTypeCell/XCUIElementTypeStaticText[@name='Last Name
    ’]")
    public MobileElement lastNameStaticText;
    /**********/
    String fName = userInfo.getFirstName();
    System.out.println("Setting first name as: " + fName);
    //Type the first name into the firstNameField
    this.firstNameField.sendKeys(fName);
    System.out.println("We think we set the first name as: " + fName);

    //Get the lastName from the userInfo object
    String lName = userInfo.getLastName();
    System.out.println("Setting last name as: " + lName);
    //Enter the lastName into the lastNameField
    this.lastNameField.sendKeys(lName);
    System.out.println("We think we set the last name as: " + lName);

    //Get the lastName from the userInfo object
    String lName = userInfo.getLastName();
    System.out.println("Setting last name as: " + lName);
    //Enter the lastName into the lastNameField
    this.lastNameField.sendKeys(lName);
    System.out.println("We think we set the last name as: " + lName);

error as below- nor iphone x also issue

139 [main] INFO org.mongodb.driver.cluster - No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, serverDescriptions=[ServerDescription{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]}. Waiting for 30000 ms before timing out
REPORTING ERROR: If running on localhost with no local mongoDB installation, you can safely ignore a com.mongodb.MongoSocketOpenException message above. It cannot be caught.
REPORTING ERROR: Timeout occurred trying to write results to localhost:27017,test_results results_alm_java
TEST_SET_ID environment variable not set, so not recording results to ALM
FAILED: iOS_CreateAccount_LoginOut_DashboardShowsNameAvatar_TEST
org.openqa.selenium.NoSuchElementException: Can’t locate an element by this strategy: Locator map:

  • native content: “By.xpath: //XCUIElementTypeCell[@name=‘First Name, Required, Text field’]”
  • html content: “by id or name “firstNameField””
    at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(AppiumElementLocator.java:119)
    at io.appium.java_client.pagefactory.interceptors.InterceptorOfASingleElement.intercept(InterceptorOfASingleElement.java:61)
    at io.appium.java_client.ios.IOSElement$$EnhancerByCGLIB$$184e91dc.sendKeys()
    at IOS_PageObjects.CreateAccount_IOS.CreateAccount_Page.createNewAccount(CreateAccount_Page.java:752)
    at IOS_TestCases.CreateAccount.TEST_40964_01_CreateAccount_LoginOut_DashboardShowsNameAvatar.iOS_CreateAccount_LoginOut_DashboardShowsNameAvatar_TEST(TEST_40964_01_CreateAccount_LoginOut_DashboardShowsNameAvatar.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
    at org.testng.TestRunner.privateRun(TestRunner.java:782)
    at org.testng.TestRunner.run(TestRunner.java:632)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
    at org.testng.SuiteRunner.run(SuiteRunner.java:268)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)
    at org.testng.TestNG.run(TestNG.java:1064)
    at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
    at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
    at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)
    Caused by: org.openqa.selenium.TimeoutException: Expected condition failed: waiting for io.appium.java_client.pagefactory.AppiumElementLocator$WaitingFunction@48e7b3d2 (tried for 10 second(s) with 500 MILLISECONDS interval)
    at org.openqa.selenium.support.ui.FluentWait.timeoutException(FluentWait.java:264)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:232)
    at io.appium.java_client.pagefactory.AppiumElementLocator.waitFor(AppiumElementLocator.java:91)
    at io.appium.java_client.pagefactory.AppiumElementLocator.findElement(AppiumElementLocator.java:112)
    … 28 more
    Caused by: org.openqa.selenium.NoSuchElementException: 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: 2.05 seconds
    For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
    Build info: version: ‘3.4.0’, revision: ‘unknown’, time: ‘unknown’
    System info: host: ‘nw-binyp000-mb’, ip: ‘fe80:0:0:0:187c:7f0b:932f:f086%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.6’, java.version: ‘1.8.0_131’
    Driver info: io.appium.java_client.ios.IOSDriver
    Capabilities [{deviceName=iPhone X, fullReset=true, platform=UNIX, showIOSLog=true, appium-version=1.0, newCommandTimeout=1000, platformVersion=11.0, webStorageEnabled=false, automationName=XCUITest, browserName=iPhone X, takesScreenshot=true, javascriptEnabled=true, platformName=iOS, udid=EEDECB0C-14E9-450D-9759-938AF2B9A7F5, app=/Users/sannp003/Documents/iOSApp/WDW.app, networkConnectionEnabled=false, noSign=true, appiumVersion=1.7.2, databaseEnabled=false, version=11.0, launchTimeout=60000, locationContextEnabled=false, name=Default test.iOS_CreateAccount_LoginOut_DashboardShowsNameAvatar_TEST, waitForAppScript=$.delay(10000); true;, deviceOrientation=portrait, autoAcceptAlerts=true}]
    Session ID: 8228ea66-ebd8-40af-956d-10d77ae8f2f1
    *** Element info: {Using=xpath, value=//XCUIElementTypeCell[@name=‘First Name, Required, Text field’]}
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)
    at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)
    at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671)
    at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)
    at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
    at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:410)
    at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:62)
    at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
    at io.appium.java_client.ios.IOSDriver.findElement(IOSDriver.java:1)
    at org.openqa.selenium.remote.RemoteWebDriver.findElementByXPath(RemoteWebDriver.java:509)
    at io.appium.java_client.DefaultGenericMobileDriver.findElementByXPath(DefaultGenericMobileDriver.java:140)
    at io.appium.java_client.AppiumDriver.findElementByXPath(AppiumDriver.java:1)
    at io.appium.java_client.ios.IOSDriver.findElementByXPath(IOSDriver.java:1)
    at org.openqa.selenium.By$ByXPath.findElement(By.java:361)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:402)
    at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:58)
    at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
    at io.appium.java_client.ios.IOSDriver.findElement(IOSDriver.java:1)
    at io.appium.java_client.pagefactory.bys.ContentMappedBy.findElement(ContentMappedBy.java:36)
    at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:402)
    at io.appium.java_client.DefaultGenericMobileDriver.findElement(DefaultGenericMobileDriver.java:58)
    at io.appium.java_client.AppiumDriver.findElement(AppiumDriver.java:1)
    at io.appium.java_client.ios.IOSDriver.findElement(IOSDriver.java:1)
    at io.appium.java_client.pagefactory.AppiumElementLocator.lambda$0(AppiumElementLocator.java:113)
    at io.appium.java_client.pagefactory.AppiumElementLocator$WaitingFunction.apply(AppiumElementLocator.java:167)
    at io.appium.java_client.pagefactory.AppiumElementLocator$WaitingFunction.apply(AppiumElementLocator.java:1)
    at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:209)
    … 30 more

Error
[element.sendKeys(“Tiru”)] Error response status: 13, UnknownError - An unknown server-side error occurred while processing the command. Selenium error: An unknown server-side error occurred while processing the command. Original error: An unknown server-side error occurred while processing the command

Console error-
151 [main] INFO org.mongodb.driver.cluster - No server chosen by WritableServerSelector from cluster description ClusterDescription{type=UNKNOWN, connectionMode=SINGLE, serverDescriptions=[ServerDescription{address=localhost:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSocketOpenException: Exception opening socket}, caused by {java.net.ConnectException: Connection refused (Connection refused)}}]}. Waiting for 30000 ms before timing out

REPORTING ERROR:

REPORTING ERROR: Timeout occurred trying to write results to localhost:27017,test_results results_alm_java

TEST_SET_ID environment variable not set, so not recording results to ALM

FAILED: iOS_CreateAccount_LoginOut_DashboardShowsNameAvatar_TEST

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)

Command duration or timeout: 15.61 seconds

Build info: version: ‘3.4.0’, revision: ‘unknown’, time: ‘unknown’

System info: host: ‘nw-binyp000-mb’, ip: ‘fe80:0:0:0:187c:7f0b:932f:f086%en0’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.13.6’, java.version: ‘1.8.0_131’

Driver info: io.appium.java_client.ios.IOSDriver

Capabilities [{deviceName=iPhone 7, fullReset=true, platform=UNIX, showIOSLog=true, appium-version=1.0, newCommandTimeout=1000, platformVersion=11.0, webStorageEnabled=false, automationName=XCUITest, browserName=iPhone 7, takesScreenshot=true, javascriptEnabled=true, platformName=iOS, udid=E2E9CA28-F7A3-43AC-8554-39F61729B4BC, app=/Users/sannp003/Documents/iOSApp/WDW.app, networkConnectionEnabled=false, noSign=true, appiumVersion=1.7.2, databaseEnabled=false, version=11.0, launchTimeout=60000, locationContextEnabled=false, name=Default test.iOS_CreateAccount_LoginOut_DashboardShowsNameAvatar_TEST, waitForAppScript=$.delay(10000); true;, deviceOrientation=portrait, autoAcceptAlerts=true}]

Session ID: 89c3b24e-5e22-443d-a2d0-4cd86dd16cb8

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)

at java.lang.reflect.Constructor.newInstance(Constructor.java:423)

at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:215)

at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:167)

at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:671)

at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42)

at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)

at io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1)

at org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:272)

at io.appium.java_client.DefaultGenericMobileElement.execute(DefaultGenericMobileElement.java:45)

at io.appium.java_client.MobileElement.execute(MobileElement.java:1)

at io.appium.java_client.ios.IOSElement.execute(IOSElement.java:1)

at org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:96)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at io.appium.java_client.pagefactory.ElementInterceptor.getObject(ElementInterceptor.java:40)

at io.appium.java_client.pagefactory.interceptors.InterceptorOfASingleElement.intercept(InterceptorOfASingleElement.java:62)

at io.appium.java_client.ios.IOSElement$$EnhancerByCGLIB$$184e91dc.sendKeys(<generated>)

at IOS_PageObjects.CreateAccount_IOS.CreateAccount_Page.createNewAccount(CreateAccount_Page.java:755)

at IOS_TestCases.CreateAccount.TEST_40964_01_CreateAccount_LoginOut_DashboardShowsNameAvatar.iOS_CreateAccount_LoginOut_DashboardShowsNameAvatar_TEST(TEST_40964_01_CreateAccount_LoginOut_DashboardShowsNameAvatar.java:104)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

at java.lang.reflect.Method.invoke(Method.java:498)

at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:86)

at org.testng.internal.Invoker.invokeMethod(Invoker.java:643)

at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:820)

at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1128)

at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)

at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)

at org.testng.TestRunner.privateRun(TestRunner.java:782)

at org.testng.TestRunner.run(TestRunner.java:632)

at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)

at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)

at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)

at org.testng.SuiteRunner.run(SuiteRunner.java:268)

at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)

at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)

at org.testng.TestNG.runSuitesSequentially(TestNG.java:1244)

at org.testng.TestNG.runSuitesLocally(TestNG.java:1169)

at org.testng.TestNG.run(TestNG.java:1064)

at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)

at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)

at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

===============================================

Default test



at IOS_PageObjects.CreateAccount_IOS.CreateAccount_Page.createNewAccount(CreateAccount_Page.java:755)



     this.firstNameStaticText.sendKeys("Prah");



@iOSFindBy(accessibility	 = "First Name*")



public MobileElement firstNameStaticText;