Coded UI Test Fails to find Wpf Popup Window controls - automation

I am trying to automate a ribbon control in power point. In that ribbon there are popup windows which contains settings information, when I try to automation those setting popup windows using Coded UI, I got error message like "the control cannot be located playback fail to find control with give search properties", But Coded UI can find the popup window but it fails to find any controls inside it.I have already tried with
SearchConfiguration.AlwaysSearch and setfocus()
Does any one have solutions, it will be very helpful for me!

Find the parent object, i.e the popup window, and enumerate through the children objects manually if codedUI is not able to locate the objects.
IEnumerator<UITestControl> appt = uiMainWindowControl.GetChildren().GetEnumerator();

Related

Late binding object to existing instance via handle in VBA

This question pertains to VBA Internet Explorer automation
What I have is an Internet Explorer window that loads a dialog box with buttons when the page loads.
Here are the givens:
The dialog box is of the "Internet Explorer_TridentDlgFrame" class
It isn't considered an app window like its originating IE window.
Its "form" and button "ID's are obtainable but not within DOM of the originating IE document
So, referencing said IDs to interact with them does not work.
Similarly, injecting JavaScript attached to its buttons does not work
The dialog box can't be bypassed by closing it. A "continue" button must be pressed.
So I figured I'd use another method:
If I cycle through all windows, I can obtain the dialog box's window handle via its window title.
With that said, is there a way to late-bind "Object A" to the dialog box's window via handle?
And if so, is it then possible to late-bind "Object B" to "Object A's" document/form in order to interact with it?
This would be like accessing an existing instance of an open Excel workbook and late binding an object to it in order to interact with the workbook itself.
Note: I have used Selenium in the past, and while it may be a better solution to get around this dialog box, translating the rest of my (already) written program into Java would be a nightmare.
Note2: Using winHttp or other "headless" methods isn't an option
Any help is appreciated! Thanks!

Visual Basic : How to Block all message boxes, popups and alert dialog

I am making a webbrowser using VB 2010, and I often see popups regarding script errors or advertisement when browsing. I want to disable all message boxes and script error boxes too. I do not want to stop or block scripts from running, I want browser to continue running them but not to show the popup alerts.
WebBrowser1.silent = True isn't working
Thanks in advance
You have tagged this as VB.NET, which I believe is incorrect. In .NET you would use webBrowser.ScriptErrorsSuppressed = true as shown here: Disable JavaScript error in WebBrowser control
The Silent property is available on the ActiveX web browser control in VB6 and probably VBA (?). I believe there is a problem with setting Silent to true there, because it gets set back to false at run time whenever the control is loaded. There is an example on how to work around that by using a timer control, which is available here: http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=43907&lngWId=1

How can I locate a UI element in VB6 code?

I have no experience with VB, but I have looked around a decent amount and cannot figure this out.
I am currently recreating a VB6 application to a VB.net application. There are a bunch of elements that are hidden until certain options are chosen. Obviously, not having the element created on the form gives me this error:
Looking at the VB6 environment, I find the mDNP variable in the drop down menu on the right, but it does not tell me where it is located, or what type of UI element it is. It says Menu next to it, but I have gone through all of the menus and cannot find it anywhere.
The issue of hidden elements is not the cause of the error; even if not visible, they must exist. More likely, you havent yet (re)created that VB6 object in the new NET project code (especially if you cannot find it in VB6).
Menus were odd in VB6 and used a special editor rather than just being a component or control you added. mDNP likely relates to a drop down menu list/window. To find all these creatures in VB6:
Open the form designer
Right Click
Select Menu Editor
There is also a toolbar button, but it may missing as a result of customization:
This will show all the menu elements for this form including ones which might be set to invisible to be later invoked as PopUps or context menus in today's lingo. There is no indicator that a form has a menu (like the form tray components in .NET) other than opening the Menu Editor.

AutomationPeer - how to show data of elements not on the control?

I want to write an AutomationPeer for my custom control in WPF.
Now, I want to show textBlocks \ TextBoxex that are not actually visible on my control.
I know how to override the method GetChildrenCore().
My problem is that when i run the playback (coded ui record) - it's trying to find a control not vissible on the window. Have you got any ideas?
You can set the SearchConfiguration VisibleOnly on the Coded UI control. Also, the UITestControl.FindMatchingControls method can let you know if the search properties are too ambiguous. Coded UI stops looking for a control after the first instance of a matching control is found.
inspect.exe can shed light on a form and how Coded UI may be seeing the control.
Try opening the Designer.cs and see the hierarchy and what Coded UI is trying to find.

CTRL+ TAB when webbrowser is in focus

I have a windows application with a tabcontrol. One of the tab of the tabcontrol has a webbrowser control.Now the issue that I am facing is when the focus is inside the webbrowser control, the normal Ctrl+Tab functionality of the tabcontrol is not working.I want the Ctrl+Tab to change the selected tab of tabcontrol even when the focus is inside webbrowser control in selected tab.How to achieve this ?
I have already tries overriding ProcessCmdKey.but it does not get hit when focus is inside webbrowser control.
I also tried registerhotkey method ,it works but it locks the Ctrl+Tab hotkey within my application & system doesn't respond to any other Ctrl+Tab presses outside my application when application is running, which is expected behaviour of registerhotkey.
Here is the code you need:
If WB.ContainsFocus Then
MsgBox("We have focus, disappearing...")
WB.Document.Body.RemoveFocus()
End If
Now, the question is, when to run that code. If you put it in the WebBrowser1_GotFocus event, you'll need to turn it on and off. Turn the code off if the user is interacting with the WB Control, and turn it back on when they are not and when you expect to be experiencing the problem you've mentioned.
Of course, you could add another line to ensure a particular control/tab/panel etc gets focus after you remove focus from the body. Also, here are 3 other SO questions that have answers which may help you, but these will take you in directions different to the direction I've provided, probably due to the fact that the questions are not identical to yours, but are similar enough to be useful (not listed in order of preference).
Prevent WebBrowser control from stealing focus?
Webbrowser steals focus
Focusing WebBrowser control in a C# application
UPDATE:
I just wanted to add, instead of the .Body.RemoveFocus() you could do this:
WB.Document.Body.Parent.RemoveFocus()
Which I prefer, since the .Document object didn't have an explicit .RemoveFocus method on the intellisense I was gettign in VS2012 RC. This is probably referring to the HTML tag (and not the .Document object) and since the html tag is the only parent to the body tag, it makes sense, and there is no "HTML" object directly available in the intellisense under object, since you can get it via other means, so it's just more convenient doing it this way.
Cheers, and let me know if you need more info on anything.