im creating a console application in C# to open and connect with my Windows Desktop Application, in my computer its working but when i installed it in the cliente idk why doesnt open the application, in some post i saw that if the console application its running in other monitor (what is the client case) gets error but we noticed that if the app iVMS-4200 (its a security camera software) is open the winAppDriver does not work.
//Appium Driver URL it works like a windows Service on your PC
string appiumDriverURI = "http://127.0.0.1:4723";
//Application Key of your UWA
//U can use any .Exe file as well for open a windows Application
string calApp = #"C:\Safesmart Plus\SmartCard.exe";
AppiumOptions opt = new AppiumOptions();
opt.AddAdditionalCapability("app", calApp);
opt.AddAdditionalCapability("deviceName", "SmartCard");
WindowsDriver<WindowsElement> calSession = new WindowsDriver<WindowsElement>(new Uri(appiumDriverURI), opt);
Related
I am currently trying to create a setup project for my WinForms application and, after using the setup created, cant seem to get my app fully functional. I made an installer for my application using both (primary output) and the physical files (database, database.log, winformsapp.exe, winformsapp.exe.config files) to define the projects dependencies/prerequisites within the application. Both setups run into the same error after installing the program (when I run my installed application, it runs my applications splash/loading screen, then runs idle in the background unseen where it should prompt for a serial key-- more specifically, if working correctly, a dialog box pops up after the loading bar is done, you click it then the serial key screen pops up--). When I run the original "winformsapp.exe" -- held within "project-name/bin/debug/" -- it runs perfectly; it connects to my database strings no problem, runs through the loading screen, prompts to a serial key/ takes me straight to application if the serial key is already entered.
This is what i'm looking at visually...
"SQL SERVER A" CONNECTION STRING (database for product serial keys):
const string connectionString = #"Server = XXXSERVERNAMEXXXSQLEXP; DATABASE = berrysdatabase; USER ID = larryman99; PASSWORD = manlarry99;";
"LOCALDB A" CONNECTION STRING (database used by user, datagridview based)
SqlConnection connection = new SqlConnection(#"Data Source = (LocalDB)\MSSQLLocalDB; AttachDbFilename=C:\Users\Win_10\source\repos\Localiteration\Localiteration\Database1.mdf;Integrated Security = True");
ORIGINAL EXE FILE RUNNING from '/projectname/bin/debug' (USED TO CREATE SETUP)
https://gyazo.com/61e3fc1fdcb56db2a171057786f8e8f3
works perfectly... after clicking the dialog box, you are prompted to enter a serial key, you rerun the program and the exe authenticates and runs perfectly ( this form appears):
pops up after clicking the "goto activation form" you pop up briefly above
I attempt to use this perfect exe file in a setup for my visual basic program:
My setup prerequisites: Microsoft .NET Framework 4.7.2
I included SQL 2019 Local DB in my prerequisites and it made no difference
When I run the exe within the setup folder after it is created, this exe does not work the same... the splash screen appears, loads, then my program disappears and runs in the background where it should be prompting me for a serial key or, if the serial key is entered, let me fully into the program. I am very confused because the original exe works fine:
https://gyazo.com/36835e38e3e726f02757b51e151d142c
I am not entirely sure what I am doing wrong here, any help would be very appreciated...
I created a setup/installer with/without SQL Server 2019 Express LocalDB and it runs the same either way after being installed through the created setup
I want to send keyboard keys to an RemoteApp application. I am using C# with the Windows API.
The code example works when I am using Windows 10 Desktop with an RemoteApp application. The application appears in the foreground and the shortcut code CTRL + SHIFT + O is executed in the application.
When I start the same application on a Windows Server 2012 / 2016 Remote Desktop server in an RDS session it will set the window to the foreground but the application is not receiving the shortcut.
On a Windows 2019 Server with Remote Desktop it works great, however with versions 2012 and 2016 it doesn’t work.
I’ve also tried the following:
SendMessage and PostMessage with the handle and WM_KEYDOWN / WM_KEYUP.
Class.WinAPI.PostMessage(handle,WM_KEYDOWN,0x11,0);
Class.WinAPI.PostMessage(handle,WM_KEYDOWN,0x10,0);
Class.WinAPI.PostMessage(handle,WM_KEYDOWN,0x4F,0);
Class.WinAPI.PostMessage(handle,WM_KEYUP,0x11,0);
Class.WinAPI.PostMessage(handle,WM_KEYUP,0x10,0);
Class.WinAPI.PostMessage(handle,WM_KEYUP,0x4F,0);
foreach (KeyValuePair<IntPtr, string> window in OpenWindowGetter.GetOpenWindows())
{
IntPtr handle = window.Key;
string title = window.Value;
if (title.ToLower().Contains(“ApplicationName”))
{
Class.WinAPI.SetForegroundWindow(handle);
Thread.Sleep(1);
SendKeys.SendWait("^+O");
Thread.Sleep(1);
SendKeys.Flush();
}
}
I am having an issue with Chromedriver failing to send simulated inputs (Control + P ) on a server. The inputs that I am sending with InputSimulator (http://inputsimulator.codeplex.com/). Using Selenium and Firefox, the tests execute perfectly; however when I change over to use Chromedriver, I am encountering failures from my input simulator not properly firing on the page. That is the only difference taking place.
If I perform the test on my local machine instead of on the server, it executes flawlessly. Since InputSimulator just simulates they keys being pressed, it never reports a failure.
The servers that I am running on Windows Server 2008 R2 64 Bit.
Why would Selenium(Firefox) not have any issue and changing to Chromedriver now causes them to never send only one the servers? The only section of code changing is the driver settings.
Selenium (firefox)
FirefoxProfile profile = new FirefoxProfile(#"path/to/profile");
using (IWebDriver driver= new FirefoxDriver(profile))
{
//Navigate to URL
driver.Navigate().GoToURL(#"http://google.com");
//Wait for the page to load
Thread.Sleep(2000);
InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_P);
Thread.Sleep(2000);
InputSimulator.SimulateKeyPress(VirtualKeyCode.RETURN);
//Now I have the dialog to send my save path.
}
Chromedriver
var options = new ChromeOptionsWithPrefs();
options.prefs = new Dictionary<string, object>
{
{ "printing.print_preview_sticky_settings.appState","{\"version\":2,\"isGcpPromoDismissed\":false,\"selectedDestinationId\":\"Save as PDF\",\"selectedDestinationOrigin\":\"local\",\"customMargins\":null}" }};
options.AddArgument("--disable-extensions");
options.AddArgument("-incognito");
options.AddArgument("-start-maximized");
options.AddArgument("--renderer-print-preview");
using (IWebDriver driver= new ChromeDriver(#"C:/Chromedriver/path", options))
{
//Navigate to URL
driver.Navigate().GoToURL(#"http://google.com");
//Wait for the page to load
Thread.Sleep(2000);
InputSimulator.SimulateModifiedKeyStroke(VirtualKeyCode.CONTROL, VirtualKeyCode.VK_P);
//Code never fires on the servers; does fire on my local machine.
Thread.Sleep(2000);
}
InputSimulator does not work in Windows Server 2008 R2 and Windows 7 if Aero is off (I have not tested with other versions, yet).
For Windows 7, switch to an Aero theme and it will start working again.
For Windows Server 2008 R2, you will need to install Workstation Theme for Aero:
Run this command in command prompt:
ServerManagerCmd -i Desktop-Experience
Restart the server.
Go to services.msc and start the Themes service.
Go to Windows Display settings, select Personalize, Pick an Aero Theme.
I have a simple windows service which i need to use to invoke a console application.The console app generates pdf to print by opening the adobe reader window.Running the console app works fine to print pdf.But invoking it from service not successful.It doesnt even show up the console window where i log events.
Process pdfprocess = new Process();
pdfprocess.StartInfo.FileName = #"C:\Documents and Settings\xyz\Desktop\dgdfg\PdfReportGeneration\bin\Debug\PdfReportGeneration.exe";
pdfprocess.StartInfo.UseShellExecute = false;
pdfprocess.StartInfo.RedirectStandardOutput = true;
pdfprocess.Start();
But invoking other application like
pdfprocess.StartInfo.FileName = #"C:\Program Files\Adobe\Reader 11.0\Reader\AcroRd32.exe";
works fine.
What will be the reason?
There is probably some permissions issue there (PdfReportGeneration.exe inaccessible under service account or maybe something that it uses...)
I would advise to capture Process Monitor log to see where exactly it fails.
Windows services run in a different window station and cannot interact with the desktop, unless you're using an older version of Windows and tick a checkbox in the service properties in the service manager.
I have a web application written in C# that needs to display a message box using WSCRIPT.EXE (from C:\WINDOWS\SYSTEM32).
// Show the message in a Windows Script Message Box
ps.FileName = "wscript.exe";
ps.Arguments = string.Format("\"{0}\" \"{1}\"", strScriptName, strCleanedAlertMessage);
ps.CreateNoWindow = true;
Process.Start(ps);
This works as expected on my local PC, but does not work or error when running from our development web server.
We are running IIS 7 on a Windows Server 2008 R2.
Is this possible? Do I need to configure certain security setting son the web server?
Thanks!