0
iam在Visual C#中使用UIAutomation 2010年 我試圖在UI applicton中自動輸入文本框我已succsuffully選擇窗口我需要輸入數據但會發生什麼進入AFER數據,如果我swiched窗口或改變了集中提交的文字突然消失這裏是UIspy日誌中提起我的UIAutomation c#文本框消失與鼠標單擊或失去焦點
AutomationElement
General Accessibility
AccessKey: ""
AcceleratorKey: ""
IsKeyboardFocusable: "True"
LabeledBy: "(null)"
HelpText: ""
State
IsEnabled: "True"
HasKeyboardFocus: "False"
Identification
ClassName: "Edit"
ControlType: "ControlType.Edit"
Culture: "(null)"
AutomationId: "100"
LocalizedControlType: "edit"
Name: ""
ProcessId: "5172 (Winpoint)"
RuntimeId: "42 267278"
IsPassword: "False"
IsControlElement: "True"
IsContentElement: "True"
Visibility
BoundingRectangle: "(611, 286, 90, 20)"
ClickablePoint: "(null)"
IsOffscreen: "False"
ControlPatterns
Text
DocumentRange
Text: ""
Length: "0"
Bounding Rectangles: ""
AnimationStyleAttribute: "(not supported)"
BackgroundColorAttribute: "16777215"
BulletStyleAttribute: "(not supported)"
CapStyleAttribute: "None"
CultureAttribute: "(not supported)"
FontNameAttribute: "Microsoft Sans Serif"
FontSizeAttribute: "8"
FontWeightAttribute: "400"
ForegroundColorAttribute: "0"
HorizontalTextAlignmentAttribute: "Left"
IndentationFirstLineAttribute: "(not supported)"
IndentationLeadingAttribute: "(not supported)"
IndentationTrailingAttribute: "(not supported)"
IsHiddenAttribute: "(not supported)"
IsItalicAttribute: "False"
IsReadOnlyAttribute: "False"
IsSubscriptAttribute: "(not supported)"
IsSuperscriptAttribute: "(not supported)"
MarginBottomAttribute: "(not supported)"
MarginLeadingAttribute: "(not supported)"
MarginTopAttribute: "(not supported)"
MarginTrailingAttribute: "(not supported)"
OutlineStylesAttribute: "(not supported)"
OverlineColorAttribute: "(not supported)"
OverlineStyleAttribute: "(not supported)"
StrikethroughColorAttribute: "(not supported)"
StrikethroughStyleAttribute: "None"
TabsAttribute: "(not supported)"
TextFlowDirectionsAttribute: "(not supported)"
UnderlineColorAttribute: "(not supported)"
UnderlineStyleAttribute: "None"
Value
Value: ""
IsReadOnly: "False"
,並在這裏工作是我使用的過程中IAM targting代碼這個提交給美國自動識別碼爲100
AutomationElement firstname = GetTextElement(appElement, "100");
if (firstname != null)
{
LogMessage("OK " + Environment.NewLine);
LogMessage("typing in the first name...");
{
ValuePattern firstnameval =
firstname.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern;
firstnameval.SetValue("basem22");
// firstnameval.Text("basem");
// var textbox = AutomationElement(scope, id);
ValuePattern p = firstname.GetCurrentPattern(ValuePattern.Pattern) as ValuePattern;
p.SetValue("value");
因此,當我運行此代碼的「值」輸入的文本框,但如果我改變foucs它消失了任何想法,我試圖自動輸入該表單,並保存它。謝謝