HP-UFT WPF TextBlock object capture - c#

I am working on a WPF application where we have to automate testing.
This work fine for many components but we struggle to check a summary page where we use TextBlock to display our data.
The WPF TextBlock is not found by the HP tool. Thus we cannot check the values that we display.
We tried the following solutions but without success:
Change x:Name in Name (not the best idea right, but we tried all!)
AutomationProperties.AutomationId on the TextBloc
AutomationProperties.Name
Make the TextBlock focusable
The solution presented here: WPF Tutorial Solution
None of them Worked and we are currently blocked.
Has anyone experience with this? Is there a clean solution to solve this issue?
What we need: access TextBlock content, in particular Text from HP UFT Tool.

Here the correct answer:-
1) Open UFT
2) Open your wfp ".exe" file in UFT and run. (YourwpfFile.exe)
3) then you can able to identify the WFP window using object spy.

Related

How to add file path to custom control through [...] button of properties in design time in WPF

I am trying to develop a wpf custom control component, where in i need to browse files from my local machine through property and need to select the file at design time. To do this we would need a button (...) and textbox to to hold the file path. File browsing and selection is done at design time and in run time the file should be displayed on the WPF form. I am able to achieve this Winforms (using UItype Editor ) however i am not able to do this in WPF as there is UItypeeditor is not available in wpf.
I [1]: https://i.stack.imgur.com/Lam5a.png attached One Sample Property Image, Expected output in design time of Custom control properties for your quick reference.
I am a new bee in WPF, request you to help with a sample code or link.
Thank you for helping me in Advance.
Please check out might help you this..
Hi Please have a look at this link. it has a sample project with implementation.

Is it possible to set the WPF RenderMode in the XAML file?

I have built a GUI with XAML and Powershell. The problem is that certain visual elements such as dropdown menus are not visible when viewing the application remotely via VNC.
My search led me to this piece of code that I am supposed to run in the OnLoad method of the window to force the RenderMethod to SoftwareOnly:
RenderOptions.ProcessRenderMode = System.Windows.Interop.RenderMode.SoftwareOnly;
However, this is C#. My code-behind is Powershell.
So is there a way to either do this in Powershell, or to set the RenderMethod of the Windows in the XAML file?
The real reason I'm asking this question is because the answers provided here do not work for me. The alpha-blending option simply does not exist in recent versions of UVNC.

How can I set focus to explorer in C# WindowsApiCodepack, when used in WPF via WindowsFormsHost

i´m writing a small C# Wpf application and I integrated the ExplorerBrowser of the WindowsApiCodepack.
This is working really nice.
The only problem I have and where I haven´t found a solution so far is:
How can I programatically set the focus (keyboard focus) to the ExplorerBrowser control, so that I can select a folder without clicking on it with the mouse before?
Does someone have exerience with the control?
Additional Note:
What I found out so far is, that focus problems are a common problem for winform controls, which are inserted into a wpf window via the WindowsFormsHost class.
But i haven´t found a good workaround so far.
I don't have a clue about the WindowsApiCodepack, but I think u just have to call the ".Focus()" function of the control.

Reproduce the Microsoft Registry Editor "Edit Binary Value" Window in VS 2010 C# .NET Windows Forms

I am trying to reproduce a window from the Microsoft built-in Registry Editor. The window is the one which is opened when you select "Modify Binary Data..." from the context-menu when a value is clicked.
The goal is to make an identical(!) window in my .NET C# application using Windows Forms.
The problem is the textBox displayed in the window which contains the binary data. I have tried using a RichTextBox, but it isn't as simple as it seems to be especially when it comes to editing data and the behaviour of this textBox.
So I have 2 questions:
How to achieve an identical textBox in C# using Windows Forms? Maybe you know some other ways to reproduce this textBox?
I also need the font name used in this textBox, I couldn't find it :)
Thanks!
I can think of two ways you can approach this. The first is a DataGrid, painstakingly styled to have transparent grid lines and exact margins between columns, with filters to enforce hex digits only. All this, set alongside a richtextbox for the ASCII display, with your code synchronizing the selection between them.
Alternately, you can replace the DataGrid with a collection of TextBoxes, again styled for invisible borders, automatically adding new textboxes to the collection when the user adds more data.
All in all, it seems like an awful lot of work, especially in WinForms - WPF might make this a bit easier, especially the styling, but still a lot of work.
Regarding the name of that control - I tried using Spy++ to sniff it out, and it seems it's registered as a Window Class named "HEX", but I'm not sure that will really get you somewhere:
Here is an open source project containing a hex editor control for Winforms, looking at least very similar:
http://sourceforge.net/projects/hexbox/
I guess you can modify it accordingly to your requirements. But beware, the source code for the control is ~6000 lines of code (including more than a dozen utility classes). It inherits directly from "Control" and does all the text display using GDI+ (so no modified DataGrid or RichTextBox).

silverlight(WP7) linklabel control, urls not showing

I am building a WP7 app (RTM version of the dev tools, not the Mango Beta dev tools) and am using the silverlight linklabel control (http://silverlightlinklabel.codeplex.com/).
This control should find all urls in the text given to it, and turn them into hyperlinks, but i am finding that it finds the urls and inserts the hyperlinks, but no text is shown, even though the text property is set on the hyperlink object.
While i have been playing around, i have found its possible to click the hyperlink and take you into mobile IE to visit the url, but there is no visible text.
I am using the latest version of the control, i only made one change so it works correctly on WP7 which is to do with the creation of relative Uri's
So what i am asking is, has anyone else tried this and found a solution? Or is there a better way of doing it?
Thanks in advance for your help

Categories