簡體   English   中英

有沒有辦法在TestStack.White中獲取自定義控件類型內的所有元素

[英]Is there a way to get all the elements inside a Custom Control type in TestStack.White

我剛剛使用WPF Framework在Visual Studio中創建了一個桌面應用程序,並且我的應用程序包含許多自定義控件類型。 該應用程序的目的是學習使用TestStack.White的自動化。

除了自定義控件類型之外,我大多數都能自動化。 實際的問題是,我無法在自定義控件中獲取元素。 在谷歌搜索時,我發現了類似

CustomUIItem customControl = item as CustomUIItem;
IUIItem[] items = customControl.AsContainer().GetMultiple(SearchCriteria.All);

但是對於我的C#代碼, customControl.AsContainer()無法正常工作。 我不知道是否是因為任何版本依賴性。 因此,如果有人知道在TestStack.White AsContainer()與自定義控件類型一起使用的方法,請提供幫助。

如果我正確理解了您的問題,那么您應該可以

CustomUIItem customControl = item as CustomUIItem;
IUIItem[] items = customControl.GetMultiple(SearchCriteria.All);

正如這個問題的答案

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM