I recently updated to Windows 7, VS2.2010 and IE8. We have an automation suit running against IT using the Vatian, these tests require a logon communication handler so that different ads users can be logged into the IE browser.
It works perfectly when using Windows XP and IE8, but now Windows 7 can not be detected by using Windows 7, then ignore the dialog box. is being done. This is the method used to start the browser:
Public Static Browser StartBrowser (String URL, String Username, String Password) {Browser Browser = New IE (); WatiN.Core.DialogHandlers.LogonDialogHandler ldh = NewWatiN.Core.DialogHandlers.LogonDialogHandler (username, password); Browser.DialogWatcher.Add (LDH); Browser.GoTo (url); Return browser; }
Any suggestions or help would be greatly appreciated ...
For any reason, Clint commented instead of using username, password and submitting, and referred to an undefined method, but otherwise is OK. Here is some complete (and working) code:
Win7Login (String Username, String Password, String URL), Public Static Browser {Process ieProcess = Process.start ("iexplore.exe" , URL); IeProcess.WaitForInputIdle (); Thread.Sleep (2000); Automation element, ie Windows = Automation element. Froghandal (i.e. Process Manvindhandel); String t = vido Present. Classname Toasting (); Condition condition = new end condition (new property condition (i.e. enabled property, true), new property condition (AutomationElement.Control TypePortmarket, ControlType.indo)); Bet list combination = new endcondition (new property condition (Automation element. Enable enabled property, true), new property condition (AutomationElement.Control TypePortmarket, ControlType.listime)); Condition edit_condition = new endcondition (new property condition (i.e. integrated property, true), new property condition (automation element.controll typeporketti, controltip.edit)); Bet button_ conditions = new condition (new property condition (Automation element .is enabled property, true), new property condition (automation element. Control typepipty, control type.button)); Automation ElementCollection c = i.e. Window (Treescope children, conditions); Foreach (AutomationElement child in c) {if (child.Current.ClassName.ToString () == "# 32770") {// list automation element selection list = child.FindAll (TreeScope.Children, List_condition); // button AutomationAlmentCallion button = find the child. Fund all (Treescope children, button_condition); Forward (Automation Element List in List) {If (list.Current.ClassName.ToString () == "UserType") {AutomationAlmentCollection Edit = List.Fundal (Treescope children, Edit Conditions); Foreign exchange (editing automation element editing) {If edit (current .not.content ("username")) {edit.SetFocus (); ValuePattern usernamePattern = edit.GetCurrentPattern (ValuePattern.Pattern) as ValuePattern; UsernamePattern.SetValue (username); } If edit (presently includes the current name. ("Password")) {edit.SetFocus (); ValuePattern passwordPattern = edit.GetCurrentPattern (ValuePattern.Pattern) as ValuePattern; PasswordPattern.SetValue (password); }}}} Foreach (Automation element button in the button) {if (button.Current.AutomationId == "SubmitButton") {InvokePattern submitPattern = Button. GetCurrentPattern (InvokePattern.Pattern) as InvokePattern; SubmitPattern.Invoke (); break; }}}} IE.AttachTo & lt; IE & gt; (Search By ("HWD", meaning Windows. }
Comments
Post a Comment