如何使用appium在混合应用程序中自动化第三方支付页面?
how to automate third-party payment page inside hybrid application using appium?
我正在尝试使用 Appium 自动化混合应用程序,该应用程序正在使用第三方支付网关,因此当用户必须使用 VISA 卡付款时,它会在 webview 中打开他们的页面。驱动程序无法获取支付页面的页面源。
我认为该应用程序正在打开另一个 window,这就是我无法捕获它的原因,因此为了捕获它,您需要遍历所有 windows 并确保通过检查现有元素,当前使用的 window 是所需的。
这是 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;
}
我正在尝试使用 Appium 自动化混合应用程序,该应用程序正在使用第三方支付网关,因此当用户必须使用 VISA 卡付款时,它会在 webview 中打开他们的页面。驱动程序无法获取支付页面的页面源。
我认为该应用程序正在打开另一个 window,这就是我无法捕获它的原因,因此为了捕获它,您需要遍历所有 windows 并确保通过检查现有元素,当前使用的 window 是所需的。 这是 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;
}