scrollIntoView文本对象通过变量传递时,如何在Appium中使用UiScrollable函数?

How to use the UiScrollable function in Appium when the scrollIntoView text object is passed through a variable?

如果直接传递国家,即阿尔及利亚代替引号中的国家,它工作正常,但是,如果使用变量,则会弹出错误。

请建议当元素在变量中时如何滚动和查找元素。

String country = "Algeria";
driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(country))").click();

Error: Could not parse expression new UiScrollable(new uiSelector()).scrollIntoView(text(country)): 'UiScrollable' doesn't have suitable method 'scrollIntoView' with arguments [text(country)]

试试下面的方法:

String country = "Algeria";
driver.findElementByAndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView(text(\"" +country +"\"))").click();