Forum Xamarin Xamarin.iOS

Xamarin UITest : Issue with login function for iOS App using WKWebView

Hi folks, need a bit of help with an issue where I have a Xamarin UITest framework and with some recent changes that were done in the Webinstance of the app the login functions for the iOS app have stopped working. When using the Repl tool and identify the elements all three of the required Login field, Password field and Login button and identified by the Query and I am able to input values from the Repl tool using the 'app.EnterText' command to either of the input fields or click the button displayed. But as soon as values are entered for one of the fields (and dismiss keyboard command) or click the sign in button, things go haywire.From that point on the other field kind of freezes and where the query retruns the result you cannot input value to the other field and more strangely your command to click the button actually clicks the Password field. I tried various options to uniquely identify the fields using the .Css or Xpath options but the behavior seems to be on same lines. I am posting below the code on how the webinstance automation tests uses the login fn and how I am trying to do the same but with no success yet. I tried the case where you try to send the app to the background for an instance and check if that enables the other field (works with one other Appium framework I am using) for text entry but does not seem to work too. Hope someone else here had a similar case and found a way to work around it or fix it. Thanks


          public By UsernameInput = By.CssSelector("input#username");
          public By PasswordInput = By.CssSelector("input#password");
          public By LoginBtn = By.CssSelector("button#loginbtn");
          public By Title = By.CssSelector("head > title");
          public By LoginHeaderTxt = By.XPath(".//h2[contains(text(),'Signin')]");

   // Code I am trying. 

            app.Tap(x => x.Class("WKWebView").Css("input#username"));
            app.Tap(x => x.Class("WKWebView").Css("input#password"));
            app.Tap(x => x.Class("WKWebView").Css("button#loginbtn"));
Sign In or Register to comment.