WinAppDriver not working with side loaded Universal Application - winappdriver

I am unable to load a side loaded Windows Universal application using WinAppDriver
I have verified my code works if I try to load the Windows Calculator application but I am unable to load my target application. I get an error message "The system cannot find the file specified". I used the Get-AppxPackage method in PowerShell to get the application information for my target application. The method returned the data structure below:
Name : AACE4B69.MazikAXCashier
Publisher : CN=XXXXXXXXXXX
Architecture : Neutral
ResourceId :
Version : 2.4.1.9
PackageFullName : AACE4B69.MazikAXCashier_2.4.1.9_neutral__gfhc11b3bvd9y
InstallLocation : C:\Program Files\WindowsApps\AACE4B69.MazikAXCashier_2.4.1.9_neutral__gfhc11b3bvd9y
IsFramework : False
PackageFamilyName : AACE4B69.MazikAXCashier_gfhc11b3bvd9y
PublisherId : gfhc11b3bvd9y
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
NonRemovable : False
Dependencies : {Microsoft.WinJS.2.0_1.0.9600.17018_neutral__8wekyb3d8bbwe}
IsPartiallyStaged : False
SignatureKind : Developer
Status : Ok
I have tried to load the application using the following fields in the AppID field:
Name
PackageFullName
PackageFamilyName
[TestFixture]
public class Tests
{
protected static WindowsDriver<WindowsElement> windowSession;
public const String AppID = "AACE4B69.MazikAXCashier_2.4.1.9_neutral__gfhc11b3bvd9y";
public const String driverURL = "http://127.0.0.1:4723";
[SetUp]
public void Setup()
{
if (windowSession == null)
{
// Configure the application connection and load data
AppiumOptions opt = new AppiumOptions();
opt.AddAdditionalCapability("app", AppID);
try
{
// Create the driver object
windowSession = new WindowsDriver<WindowsElement>(new Uri(driverURL), opt);
Assert.IsNotNull(windowSession);
}
catch (Exception e)
{
Console.WriteLine("Unable to open application with error: " + e.Message);
}
}
}
[Test]
public void Test1()
{
Assert.Pass();
}}
I would expect one of these names to be the required Application ID and result in the app loading. Instead I get the error message "The system cannot find the file specified".
This application is side loaded and I am wondering if there is something different about that. Any help or suggestions are appreciated.

OK, I figured out the trick. I needed to user the PackageFamilyName appended with a qualifier. In my case this came out to be
public const String AppID = "AACE4B69.MazikAXCashier_gfhc11b3bvd9y!App";
I got this value via a two step process. I used the Powershell Get-appxPackage Mazik to get the PackageFamilyName as I previously did. I then appended "!App" to this string to get the required value. I determined the "!App" string based on another Powershell script I found in an online article. I used the following script to determine what the appended ID value was:
(Get-AppxPackageManifest (Get-AppxPackage Mazik)).package.applications.application.id
This returned "App" and I constructed the final string as described above. It looks like the "!App" is the typical ending to the required AppID but I have to assume there are different values for different situations. Once I got the correct AppID value everything worked as expected and the side loaded application was not an issue

The application key is usually a little shorter I believe. Are you sure you didn't make a mistake while copying it over to your code? Please double check app IDs for errors.
I created a shortcut to the Clocks app and then right clicked it. The "Target type" and "Target" fields contain the exact application key that work.

Related

Can anyone tell me the Java utility to download documents to your local PC from Content Engine in filenet?

Hello Guys I am trying to write the java utility to download the documents to local PC from content engine in filenet can anyone help me out?
You should read about FileNet P8 CE API, you can start here:
You have to know that the FileNet Content Engine has two types of interface that can be used to connect to it: RMI and SOAP. A cmd line app you are planning to write, can connect only by SOAP (I am not sure that this is true for the newest versions, but what is definitely true, that it is much easier to setup the SOAP connection than EJB), so you have to read that part of the documentation, how to establish a connection in this way to your Content Engine.
On the link above, you can see that first of all you have to collect the required jars for SOAP connection: please check the "Required for a Content Engine Java API CEWS transport client" section for the file names.
After you collect them, you will need a SOAP WSDL URL and a proper user and password, the user has to have read properties and read content right to the documents you would like to download. You also need to know the ObjectStore name and the identifier or the location of your documents.
Now we have to continue using this Setting Up a Thick Client Development Environment link (I opened it from the page above.)
Here you have to scroll down to the "CEWS transport protocol (non-application-server dependent)" section.
Here you can see, that you have to create a jaas.conf file with the following content:
FileNetP8WSI {
com.filenet.api.util.WSILoginModule required;
};
This file must be added as the following JVM argument when you run the class we will create:
java -cp %CREATE_PROPER_CLASSPATH% -Djava.security.auth.login.config=jaas.conf DownloadClient
Now, on the top-right corner of the page, you can see links that describes what to do in order to get a connection, like "Getting Connection", "Retrieving an EntireNetwork Object" etc. I used that snipplet to create the class below for you.
public class DownloadClient {
public static void main(String[] args) throws Exception{
String uri = "http://filenetcehost:9080/wsi/FNCEWS40MTOM";
String userId = "ceadmin";
String password = "password";
String osName = "Test";
UserContext uc = UserContext.get();
try {
//Get the connection and default domain
Connection conn = Factory.Connection.getConnection(uri);
Domain domain = Factory.Domain.getInstance(conn, null);
ObjectStore os = Factory.ObjectStore.fetchInstance(domain, osName, null);
// the last value (jaas samza name) must match with the name of the login module in jaas.conf
Subject subject =UserContext.createSubject(connection, userId, password, "FileNetP8WSI");
// set the subject to the local thread via threadlocal
uc.pushSubject(subject);
// from now, we are connected to FileNet CE, and objectStore "Test"
//https://www.ibm.com/support/knowledgecenter/en/SSNW2F_5.2.0/com.ibm.p8.ce.dev.ce.doc/document_procedures.htm
Document doc = Factory.Document.getInstance(os, ClassNames.DOCUMENT, new Id("{F4DD983C-B845-4255-AC7A-257202B557EC}") );
// because in FileNet a document can have more that one associated content element
// (e.g. stores single page tifs and handle it as a multipaged document), we have to
// get the content elements and iterate list.
ContentElementList docContentList = doc.get_ContentElements();
Iterator iter = docContentList.iterator();
while (iter.hasNext() )
{
ContentTransfer ct = (ContentTransfer) iter.next();
// Print element sequence number and content type of the element.
// Get and print the content of the element.
InputStream stream = ct.accessContentStream();
// now you have an inputstream to the document content, you can save it local file,
// or you can do what you want with it, just do not forget to close the stream at the end.
stream.close();
}
} finally {
uc.popSubject();
}
}
}
This code is just shows how can you implement such a thick client, I have created it now using the documentation, not production code. But after specifying the packages to import, and may handle the exceptions it will probably work.
You have to specify the right URL, user, password and docId of course, and you have to implement the copy from the TransferInputStream to a FileOutputStream, e.g. by using commons.io or java NIO, etc.

Define download path dotnetbrowser

I use dotnetbrowser to display a web browser on a old windows framework.
have you an idea to define the download path ?
My dotnetbroser is enable, i can show my webpage but i don't found in documentation or exemple how define this simple download path.
The only exemple that i've found is about the download event detection.
I use WPF in C#
Thanks.
The DotNetBrowser.DownloadItem.DestinationFile property is writable and can be used to configure the path to store the file.
To set this property in your application, you need to subclass the DotNetBrowser.DefaultDownloadHandler and implement its AllowDownload(DownloadItem) method. Then you need to configure your download handler as shown in the documentation article: File Download
You can also configure and use DotNetBrowser.WPF.WPFDefaultDownloadHandler instance to show file chooser and select the path to store the file.
This is a solution
Défine your browser like variable :
BrowserView myBrowserView;
Browser myBrowser;
Create the browser properly :
this.myBrowser = BrowserFactory.Create();
this.myBrowserView = new WPFBrowserView(this.myBrowser);
Create event detection for download
this.myDowloadHandler = new SampleDownloadHandler();
this.myBrowser.DownloadHandler = myDowloadHandler;
Add it to a container, here, a grid
grid_navigateur.Children.Add((UIElement)myBrowserView.GetComponent());
Now we are going to use our "SampleDownloadHandler" class
class SampleDownloadHandler : DownloadHandler
{
public bool AllowDownload(DownloadItem download)
{
download.DestinationFile = "exemple\of\path\whith\file\name";
download.DownloadEvent += delegate(object sender, DownloadEventArgs e)
{
DownloadItem downloadItem = e.Item;
if (downloadItem.Completed)
{
System.Windows.MessageBox.Show("Download complete");
}
};
return true;
}
My personalisated class define path and name of the file who is download and pop a message when is over.
(to found the file name, you do to cut the string download.DestinationFile after the last )

ETW EventSource not logging events on Windows Server

I wrote an ETW EventSource using the Microsoft EventSource Libary 1.1.25 on Nuget. The purpose of the EventSource is to send events to a custom event log for a security application we maintain. The code works locally, but we can not get events to be written to the event log on the server.
The EventSource is named (similar too) Company-Security and sends events to the Admin Channel. Locally on my development machine, I can register the eventsource manifest with wevtutil, and see the Company-Security folder with the Admin log underneath in Windows Event Viewer. When I run the application, the events are recorded in the event log.
However, when I deploy the application to the test server (running Windows Server 2012), event logging is not working. The log is created and visible in Event Viewer after I register the manifest with wevtutil, though the name is slightly different. A folder named Company-Security/Admin is created with a log named Company-Security/Admin insider the folder. I can also run perfview on the server and see the events created. However, nothing is ever written to the event log. I have also put some debug statements in the EventSource code and can see that the EventSource IsEnabled() is returning true.
Below are code snippets of the base class and the implementation class of the eventsource I wrote.
I've researched and can't find any explanation as to why event logging does not work on the server, but works on the development machine. I assume I am missing something, but not sure what.
Abstract Base Class:
public abstract class SecurityEventsBase : EventSource {
protected unsafe void WriteEvent(int eventId, long arg1, string arg2, string arg3) {
if (IsEnabled()) {
if (arg2 == null) {
arg2 = "[not provided]";
}
if (arg3 == null) {
arg3 = "[not provided]"; ;
}
fixed (char* arg2Ptr = arg2) {
fixed (char* arg3Ptr = arg3) {
EventSource.EventData* dataDesc = stackalloc EventSource.EventData[3];
dataDesc[0].DataPointer = (IntPtr)(&arg1);
dataDesc[0].Size = 8;
dataDesc[1].DataPointer = (IntPtr)arg2Ptr;
dataDesc[1].Size = (arg2.Length + 1) * 2;
dataDesc[2].DataPointer = (IntPtr)arg3Ptr;
dataDesc[2].Size = (arg3.Length + 1) * 2;
WriteEventCore(eventId, 3, dataDesc);
}
}
}
}
EventSource Class:
[EventSource(Name="Company-Security",LocalizationResources="Events.Properties.Resources")]
public sealed class AuthorizationEvents : SecurityEventsBase {
public static AuthorizationEvents Log = new AuthorizationEvents();
[Event(2000,Level=EventLevel.Informational,Channel=EventChannel.Admin,Message="User '{1}' ({0}) logged in successfully from IP Address {2}")]
public void Login(long UserId, string UserName, string IPAddress) {
if (IsEnabled()) {
WriteEvent(2000, UserId, UserName, IPAddress);
}
}
** additional events would follow here**
}
I finally resolved this problem. It had to do with permissions on the folder the manifest and binary manifest resource files were stored in.
I found this StackOverflow answer which helped me resolve the problem: https://stackoverflow.com/a/13090615/5202678
I had to grant Read & Execute privileges to the folder to the local Users group to the folder the manifest files were stored in. Once I did this, events immediately started recording in the Event Log.

google recaptcha error message

I am working on recaptcha code in my application. I would like to know if there is a default (inbuilt) method to display error message(on validation fail)? I couldn't find one, currently I am manually adding an error label on validation fail.Now the problem is I would like to remove the label once the user refresh the captcha to do another submit. Since the response textbox is provided by recaptcha , how do I attach a listener to it through java, so I can hide the error label on select event or something. Or is there a better way to handle this scenario?Its a gwt project and I am not familiar with javascript. I tried assigning a variable named incorrect_try_again(which is already available in the captcha object )with error message, but that didn't work. Could anyone tell me what's the purpose of that variable and how address the problem?
public static native void create(String key, String div, String theme, String lang, int tabIndex,
String instructionVisual, String instructionAudio, String playAgain, String cantHereThis,
String visualChalange, String audioChalange, String refreshButton, String helpButton,
String incorrectTryAgain)
/*-{
$wnd.Recaptcha.create(key, "recaptcha_div", {
theme:theme,
lang:lang,
tabindex:tabIndex,
custom_translations:{
instructions_visual : instructionVisual,
instructions_audio : instructionAudio,
play_again : playAgain,
cant_hear_this : cantHereThis,
visual_challenge : visualChalange,
audio_challenge : audioChalange,
refresh_btn : refreshButton,
help_btn : helpButton,
incorrect_try_again : incorrectTryAgain
}
});
}-*/;
Thanks in advance.
Ok. I found this article which states you can add '&error=incorrect-captcha-sol' to the challenge request URL, and the user will get an error code.
Not sure how to do this since I am not a js guy. :(
https://developers.google.com/recaptcha/docs/verify

Acessing ReportService in ReportServer From Windows Application

Here i have a windowsapplication and a SSRS Report where report is implemented in Report server,and herei try to call that report from a windows application.In my button click i add this code:
string reportName = "Crime_Traking_Report";
reportViewer1.ServerReport.ReportServerCredentials =new ReportServerCredentials("isroScientist", "password12345678", "Nasa");
reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
try
{
reportViewer1.ServerReport.ReportServerUrl = new Uri("http://13.88.91.156/ReportServer");
}
catch (UriFormatException)
{
Console.WriteLine("Bad Url format");
}
reportViewer1.ServerReport.ReportPath = "/iSROReportsStandard/" + reportName;
reportViewer1.ProcessingMode = ProcessingMode.Remote;
reportViewer1.ServerReport.Refresh();
Here definitely i want to pass the credentials to access ,but when i run my application its giving an error like this "ReportServerCredentials has no constructor Defined", what change i want to make in order to pass the credentials successfully through my code.please explain me through code.
The question is has the same solution as your other qustion Error while accessing report service(remote mode) from Report server with in a windows application. See my answer there. The ServerReport.SetDataSourceCredentials Method should be used.

Resources