How to Set DesiredCapabilities for a WPF App - wpf

I have developed a simple WPF applicaiton. I want to do some UI automation testing on my app. I started following this tutorial on how to do automation using Appium and Windows Application Driver.
As a part of setting up the test environment for testing Windows Calculator app, the following lines are added to the test script :
protected const string WindowsApplicationDriverUrl = “http://127.0.0.1:4723";
DesiredCapabilities appCapabilities = new DesiredCapabilities();
appCapabilities.SetCapability(“app”, “57b3a460–8843–4d84–822a-9f316274c2bf_tz6ph9wdjhqw8!App”);
IOSDriver<IOSElement> AppSession = new IOSDriver<IOSElement>(new Uri(WindowsApplicationDriverUrl), appCapabilities);
Looking at the 3rd line, an application identifier is provided to set DesiredCapabilities. My problem is that I have trouble finding or generating a similar app ID for my WPF application. Further down in the tutorial, author mentions:
"In the third line, we set a weird identifier for the “app” device capability. You need to replace this value with yours. It can be found the generated AppX\vs.appxrecipe file under RegisteredUserModeAppID node.
<RegisteredUserModeAppID>57b3a460–8843–4d84–822a-9f316274c2bf_tz6ph9wdjhqw8!App</RegisteredUserModeAppID>"
Can you tell me how this appID can be generated in Visual Studio? Also, is there other ways to set DesiredCapabilities without providing an appID? Can a GUID be used for this purpose?

Only UWP apps have an application id, classic Windows applications can be started with the path to the executable:
appCapabilities.SetCapability("app", pathToYourExecutable);
See also the readme of WinAppDriver:
Testing a Classic Windows Application

You should be able to find this when you're debugging your app.
If you debug the app and set a breakpoint at the first instance.
Then in your debug tab you should be able to view the node you're looking for.

Related

Handle windows Alert..(electron base desktop application) in selenium web driver

I am automating desktop application. The application is base on an electron so I can easy to get XPATH and other things like a web application. But I am stuck on windows alert.
I am trying a robot class. but a key event not supporting in electron base application.
robot.keypress(keyevent.vk_enter)
robot.keyrelease(keyevent.vk_enter)
I am trying normal selenium web driver code to handle pop but selenium does not support windows popup.
I am trying to AutoIT tools. with this code
ControlFocus("petpooja","","Button1")
ControlClick("petpooja","","Button1")
and this code
SEND("{ENTER}")
With this code
Runtime.getRuntime().exec(".\\Driver\\autoitpath\\EnterPopUp.exe");
I am also trying to use Sikuli but that also not supporting.
public Screen s = new Screen();
s.click("./Driver/Image/Popup.PNG");
Please help me guys on this I also attached the image please refer to this?enter image description here

Selenium WebDriver and ZK framework application

On a previous project i worked on, i was able to write selenium scripts conveniently by targeting the HTML attributes either by name, id, cssSelector, xPath etc. Now, i'm working on another project aimed at automating the regression test for the application. This application was built using ZK Framework (mainly because of its security feature). One of the feature of ZK is the dynamic id attribute. It generates a new id upon login or refresh. This is making the selenium development work difficult. This is a huge application. I have tried using xPath but that hasn't been successful. Any idea of other solutions out there that work specifically for ZK typed application from Selenium WebDriver perspective. Often times, the only thing present in the html is the id (which changes) and the type
Java 8
Selenium 3.11.0
You have options when testing a ZK client with selenium.
Basically, you either use an ID generator to set fixed IDs during testing, or you use components IDs with the zk.$('$id') and jq('$id') client-side selectors
You can go further, but that should already cover 99% of the use-cases
more info here:
https://www.zkoss.org/wiki/ZK_Developer%27s_Reference/Testing/Testing_Tips
and there:
https://www.zkoss.org/wiki/ZK_Client-side_Reference/General_Control/Client-side_selection_of_elements_and_widgets

Chromium embedded within WPF app with webdriver attached

I have quite unusual problem. I would like to embed Chromium inside WPF desktop app in a way that it has webdriver attached to is so I can execute operations from selenium against that embedded browser from the same application.
In other words, I would like to be able to control this embedded browser from the application using selenium (navigate, select elements, wait for elements, etc..)
From what I have found so far, it is possible to attach to CEF (cefsharp or cefglue) using webdriver but it spawns new process for the browser from external executable which is not what I'm looking for.
Is it possible to run cef inside WPF application with selenium in described scenario ?

Can't get Dynamic Data Display working with WPF Browser Application

Can I get Dynamic Data Display library working with WPF Browser App? I'm getting "Target Invocation Exception" when attempting to launch the app, regular desktop WPF app runs just fine.
Update 1: "That assembly does not allow partially trusted callers." is the error, got it by adding D3's chart plotter dynamically. Looking into it now.
Fixed by switching to "This is a full trust application" option in the Security tab of my project's properties. May not be appropriate for everyone, check for the potential implications of it. Did the trick for me though.

Lync API using PresenceIndicator outputting TypeInitializationException within InitializationCompleted

I am using the Lync API within a WPF application. I have used the Office365 Lync Lab 9.1 within the training kit. However when I move the code into my WPF application the PresenceIndicator or ContactList doesn't work. The controls are displayed however the status of the Lync user is not shown. I am using the exact same accounts that are working within the Office365 Training Lab 9.1.
When I add logging I am shown errors like the following for the PresenceIndicator:
Applying template...
Control 'PresenceIndicator' entering 'OnLoaded'
UCClientInitializationFailed:Failed to Create Provider. Error Type: TypeInitializationException
I am also trying the ContactList and that is outputting:
UCClientInitializationFailed:Failed to Create Provider. Error Type: TypeInitializationException
Also the InitializationError property within the InitializationCompleted event is showing an Unknown error. How would I troubleshoot this issue further?
This is a complete stab in the dark, but are you attempting to add controls to an existing WPF application that has never integrated with Lync before?
It may be that you are missing references in your app - double-check you have references to the following files in %program files%\Microsoft Lync\SDK\Assemblies\Desktop
Microsoft.Lync.Controls.dll
Microsoft.Lync.Controls.Framework.dll
Microsoft.Lync.Model.dll
Microsoft.Lync.Utilities.dll
Microsoft.Office.Uc.dll
Also worth checking:
Is your app builing against .NET Framework 3.5 or 4?
Are you building for AnyCPU?
If that doesn't help, you could try creating a new WPF application using the "Lync WPF Application" template in Visual Studio. If this works correctly, then compare this against your appplication for any differences in references, configuration etc.
This MSDN page may be useful.

Resources