Automating WPF application - wpf

How can we automate wpf application because in my organization I am using the application which opens through the link which we paste in the browser we don't have EXE file for that so it's getting very tedious task to automate that using selenium, can anyone help if you have any idea
I want to automate application which opens through URL but it's not web application.

If there is a WPF application there should be an exe.
May be your organization environment like when we paste URL on web it downloads the binaries(exe and dll's) at some location on your local machine and after that it is stating the WPF exe application.
In that case if you are a developer then when we build a project then all DLL and exe files found in bin\release folder. you have to pickup these local files for automation instead of deployed environment.
I have also faced same issue in my organization I build the WPF application on my local machine and I got the exe and DLL on it.
After that I did automation through WinAppDriver on it using Visual Studio with Unit Test Project.
I'll give you sample application and steps to do the WPF application automation.
Visit below GitHub project to achieve WPF application automation.
https://github.com/sandeepjadhav75502/AutomationScriptDesktopApp

Related

Problems with making Silverlight project out of browser

I have a task to make large Silverlight project run out of browser.
Fortunatelly I don't have to rewrite it to some other technology. Unfortunatelly I can not understand how to make it work OOB. I tried everything that's in guides :
enabling OOB option, installing and tryiung to debug installed app, but main thing is that when I run this app OOB I can't reach any services (no matter how I try HTML Bridge is disabled in OOB).
Is there a way to reach those services (like https://localhost/WCFRest/GetUserInfo?login=somelogin&password=somepassword) from OOB enviroment?
What should I do to reach them?
I'm sorry if this is noob quetion but I can't ask anyone else.
I assume you have a Web project in your solution. I think you changed the startup project to the silverlight project. You need to start up the Web project too.
Do the following:
Right click on the solution in the Solution Explorer and select Properties.
Select "Multiple startup projects" and set the action to "Start" (on the web project)
Or just simply right click on a HTML or ASPX file in the web project and select "View in Browser".

Deploy WPF with Kudu?

I have a solution with multiple projects. One of them is a WPF project, which I'd like to deploy via Kudu.
I have set the desired project to be deployed via app settings as per kudu doc instructions. E.g. WebProject/WebProject.csproj
But kudu deploys the wrong project, because it is the before-mentioned WPF/Windows Application type.
Is there a way where I can make some sort of configuration, so kudu can build my WPF project and deploy it?
I followed this guide, which worked quite brilliantly.
Basically you simple build your WPF project on your local machine, and put the output files in a MVC project folder. You then use Kudu to deploy your MVC project, and from there you can see your WPF application.
Just remember to include your WPF build files in the WPF project, since they will be excluded by default.

WPF Clickonce in Firefox and Chrome

We have a WPF Clickonce application, whcih is deployed in Server. It is working perfectly in IE. The application started installing on single click. But in Firefox and Chrome, the file was downloaded. How to overcome this? I know there are some plug-ins which will allow this as IE.
But my question is, Can I add these plugins into my application pre-requisites? Or what is the good approach to do that. Is there anyway that I could install the plugins by detecting the browsers before starting the clickonce app? I don't want my end users to do that.
Even if you find a way to embed plugins into ClickOnce-bootstrapper ("pre-requisite") you'll have to tell user to run it explicitly. ClickOnce doesn't support installing of dependencies transparently. You'll have an .exe file which user need to run. Usually VS wizard generates an html page (publish.html) which has client code for detecting missing pre-requisites. But actually it detects only missing .NET.
So you have to write some js-code for detecting missing/installed extensions for each browser you want to support.
Check this SO question: Checking if user has a certain extension installed
In anyway if a user has a link to .application and opens it in the browser then all pre-requisites will be ignored. As actually ClickOnce itself doesn't have such a feature as "pre-requisites" or "dependencies". It's just a helper for generating totally separated setup.exe bootstrapper.
Here links for extensions:
Firefox addin for ClickOnce applications - https://addons.mozilla.org/en-US/firefox/addon/microsoft-net-framework-assist/
Google Chrome addin for ClickOnce applications - https://chrome.google.com/webstore/detail/eeifaoomkminpbeebjdmdojbhmagnncl

How to use a Silverlight Solution

I have a Silverlight app made in Visual Studio 2010 and I want to put it on a website but I don't have the slightest clue how.
I've looked at all the msdn documentation and they all mention a .xap file that is the file you use on the website but there is no .xap and I can't find out how to compile my code into a .xap file.
Also, when I run the App and look at the source in the browser, it has my code compiled into the .xap file, but there is no .xap file!
So my question is simply how do you go about getting a Silverlight app on a website because I've been trying for hours and I can't figure it out.
A sample html or aspx page is included when you create the solution. This is the page that the browser navigates to when you hit F5. You can take that page as a basic example of how to embed a Silverlight app in a page. You should find it in the project folder.
Silverlight projects are commonly built into a XAP file when you hit "Build" in VS. This file lives in the bin/Release or bin/Debug folder and basically contains your whole application.
Steps to create a silverlight application Hosted in a web site,
Select Silverlight Application Template while adding new project in VS2010
When you click Ok, ensure that Host the Silverlight application in a new web site is Checked.(It will create a new ASP.Net web application to host the Silverlight)
If you haven't checked the Host the Silverlight application in a new web site option, you can add a new ASP.Net Web application project and then go to its properties and select Silverlight Applications option in left pane. Then Click Add, select your Silverlight Application to be hosted and click ok. You are done now.
But If haven't selected the Silverlight Application Template, then you might have created a Silverlight Class Library. It wont generate any xap file. It just gives a dll. So you need to recreate a project as mentioned above.
I believe that in Silverlight whenever you create a project, right at the beginning, it will ask you if you want to create a web app automatically. If you chose yes, something like YOUR_PROJECT_NAME.web will be created, go into that folder, you will find a folder called ClientBin.
The .xap file will be inside that folder.
HTH

WPF installation

I'm new to WPF, and created a 1st simplistic WPF application that I want it to run in a webbrowser, IE or Fox.
1 - Within the Visual Studio project, I created a /Images folder with a few .jpg files
On the WPF xaml form I have 1 image and 1 button.
When application starts, the image displays /Images/img1.jpg
When User clicks the button the image must display /Images/img2.jpg
How can I force the VS publisher to include the Images folder? Apparently I can't see it in the ApplicationFiles ?
2 - Though I was able to program and run this small app on my local computer, I'm getting lost when it comes to deploying to my hosting ASP where I have a Windows hosting account that runs .NET 3.5!
From Microsoft WPF website they say I shall deploy 3 files:
"The Application Executable .exe
The Deployment Manifest .xbap
The application Manifest .manifest
The .xbap file contains the information that ClickOnce uses to deploy the application and has the .xbap extension."
But I can's see no .xbap files at all within the published stuff!!!
Any clue please?
To answer your first question:
The images will be embedded in the compiled application, so you will not see the images in the application files.
Note:
The build action of images added to your project is 'Resource' by default - leave this as is.
Do not use the resources tab in the Project properties window, just drop and drag the images into the Images folder in the solution explorer.
To help answer your second question:
Did you create the project as an WPF Browser Application?
In your .csproj file you should see the following:
<HostInBrowser>true</HostInBrowser>
<Install>False</Install>
<ApplicationExtension>.xbap</ApplicationExtension>
<TargetZone>Internet</TargetZone>
If not, just recreate the project as a WPF Browser Application and copy your files from the existing project to the new one.

Resources