【发布时间】:2020-06-05 23:04:00
【问题描述】:
我有一个 DatePicker,它被呈现为 UIDatePickerContentView,我需要在自动测试中对其进行操作以设置日期。当显示日期选择器时,REPL 树会冻结,因此在黑暗中摸索以了解模型中的内容。我已经能够使用以下内容进行询问...
>>> app.Query(c => c.Raw("UIDatePickerContentView"))
Query for Raw("UIDatePickerContentView") gave 23 results.
[0] {
Id => null,
Description => "<UIDatePickerContentView: 0x7f99c3fc1e80; frame = (0 0; 132 32); layer = <CALayer: 0x60000713c580>>",
Rect => {
Width => 126.63,
Height => 7.12,
X => 221.83,
Y => 193.18,
CenterX => 285.15,
CenterY => 196.74
},
Label => "September",
Text => null,
Class => "UIDatePickerContentView",
Enabled => true
},
[1] {
Id => null,
Description => "<UIDatePickerContentView: 0x7f99cbc3e6a0; frame = (0 0; 132 32); layer = <CALayer: 0x600003b49ca0>>",
Rect => {
Width => 130.03,
Height => 19.39,
X => 218.59,
Y => 200.64,
CenterX => 283.6,
CenterY => 210.33
},
Label => "October",
Text => null,
Class => "UIDatePickerContentView",
Enabled => true
...但找不到任何有关此类可调用的后门方法的信息。
我可以编写一个 hacky 方法来设置日期,但我确信一定有更好的方法来设置日期。任何想法将不胜感激。
堆栈跟踪:
Execution failed with exception: System.Net.WebException: GET Failed
at Xamarin.UITest.Shared.Http.HttpClient.HandleHttpError (System.String method, System.Exception exception, Xamarin.UITest.Shared.Http.ExceptionPolicy exceptionPolicy) [0x0003c] in <12fefce8c9d24a03847e99ca872ebbec>:0
at Xamarin.UITest.Shared.Http.HttpClient.Request (System.String method, System.String endpoint, Xamarin.UITest.Shared.Http.ExceptionPolicy exceptionPolicy, System.Nullable`1[T] timeOut) [0x00155] in <12fefce8c9d24a03847e99ca872ebbec>:0
at Xamarin.UITest.Shared.Http.HttpClient.Get (System.String endpoint, Xamarin.UITest.Shared.Http.ExceptionPolicy exceptionPolicy, System.Nullable`1[T] timeOut) [0x00000] in <12fefce8c9d24a03847e99ca872ebbec>:0
at Xamarin.UITest.iOS.HttpCalabashConnection.Dump () [0x00000] in <12fefce8c9d24a03847e99ca872ebbec>:0
at Xamarin.UITest.iOS.iOSGestures.Dump () [0x00000] in <12fefce8c9d24a03847e99ca872ebbec>:0
at Xamarin.UITest.Utils.TreePrintHelper.PrintTree (Xamarin.UITest.Utils.ITreePrinter treePrinter) [0x00006] in <12fefce8c9d24a03847e99ca872ebbec>:0
at Xamarin.UITest.Queries.AppPrintHelper.Tree (System.Nullable`1[T] console) [0x0001c] in <12fefce8c9d24a03847e99ca872ebbec>:0
at <InteractiveExpressionClass>.Host (System.Object& $retval) [0x00010] in <7453cce1cdcc4fe4afe263a530a7fb22>:0
at Mono.CSharp.Evaluator.Evaluate (System.String input, System.Object& result, System.Boolean& result_set) [0x0003e] in <e5610ebfe8c34526a8158db3c89186d4>:0
at Xamarin.UITest.Repl.Evaluation.MonoCSharpReplEngine.Evaluate (System.String line) [0x00017] in <36fced282c0c46b3875df4694444ba35>:0
at Xamarin.UITest.Repl.Repl.ReplFacade.RunCode (System.String code) [0x00026] in <b735ea7cb64e4833abf7213ad2e5f225>:0
at Xamarin.UITest.Repl.PromptHandler.PrintTree () [0x00000] in <b735ea7cb64e4833abf7213ad2e5f225>:0
at Xamarin.UITest.Repl.PromptHandler.HandleInput (System.ConsoleKeyInfo key) [0x00072] in <b735ea7cb64e4833abf7213ad2e5f225>:0
at Xamarin.UITest.Repl.Program.Main (System.String[] args) [0x00177] in <b735ea7cb64e4833abf7213ad2e5f225>:0
Press any key to exit.
【问题讨论】:
标签: ios xamarin datepicker uitest