Search code examples
appiumhybrid-mobile-app

how to automate third-party payment page inside hybrid application using appium?


I am trying to automate a Hybrid application using Appium , the application is using a third party payment gateway, so it opens their page in a webview when the user has to pay using a VISA card. the driver is not able to get the page source for the payment page.


Solution

  • I think the app is opening another window , that is why I am not able to capture it, so in order to capture it , you need to loop through all windows and ensure that the currently used window is the desired one by checking the existed elements. here is the code in C#

                foreach (var Wind in Setup.driver.WindowHandles)
                {
                    Console.WriteLine("Window name is " + item );
                    Setup.driver.SwitchTo().Window(item);
                    Console.WriteLine(Setup.driver.Url);                    
                    var Condition= Setup.driver.FindElements(By.XPath
                    ("//button[contains(.,'Pay')]")).Count;
                    Console.WriteLine(x);
                    if (x == 1)
                    {  
                        break;
                    }