问题描述
随着我们的应用登录页面从 ADAL 库升级到 MSAL 库。我们无法通过自动化找到用于登录选项的定位器(自动化 ID)。
我们试过了
Dim FiletoOpen As Variant
dim tempFile as workbook
dim tempWs as worksheet
dim thisWs as worksheet
Application.ScreenUpdating = False
set thisWs = ThisWorkbook.Worksheets("Sheet1")
FiletoOpen = Application.GetopenFilename _
(Title:="Please choose a Excel File to Open",_
FileFilter:="Excel Files *.xlsx(*.xlsx),")
If VarType(FiletoOpen) = vbBoolean Then
MsgBox "No file selected",vbExclamation,"Sorry!"
Exit Sub
End If
Debug.Assert VarType(FiletoOpen) = vbString
set tempFile =Workbooks.Open(FiletoOpen)
set tempWs = tempFile.worksheets(1)
tempWs .cells.copy thisWs.Range("A1")
tempFile .close
set tempFile = nothing
set tempWs = nothing
Application.ScreenUpdating = true
但该值未输入用户名字段并低于异常异常:System.Exception:文本输入不可见键盘。 在 Xamarin.UITest.iOS.iOSApp+c__displayClass19_0.b__0 () [0x0002b] 在 :0
识别用户名字段的任何建议。
解决方法
您需要先将 Xamarin.UITest 添加到 Xamarin.Forms 解决方案中。
并为条目设置 AutomationId
。
xml:
<Entry AutomationId="UserID" />
<Entry AutomationId="Password" />
UITest:
[Test]
public void test3()
{
app.EnterText("UserID","5");//UserID is 5
app.PressEnter();
app.EnterText("Password","123456");//password is 123456
app.PressEnter();
}