0

I am pretty good googler but I have hit a road block this time. I created a C# WinForm app that opens the application ICBusinessManager's login window. What I can't figure out is how to make my winform log in automatically. The IC app's login window has a 'Log on' and a 'Cancel' button. I am fairly new to development(currently self-teaching) and I apologize in advance if I am not clear. Please ask if you need me to be more specific.

 private void roboDialerBtn_Click(object sender, EventArgs e)
{

            Process roboDialer = new Process();
            roboDialer.StartInfo.FileName = "ICBusinessManager.exe";
            roboDialer.StartInfo.Arguments = "ProcessStart.cs";  
            roboDialer.Start();

        }
Luis
  • 5
  • 1
  • way too broad to be answered. Have a look here: https://stackoverflow.com/questions/517694/ui-automation-selected-text – rene Oct 10 '17 at 18:53
  • Your best bet is using automated tools to put in the username and password and click Log on after you start the process. There is no way of doing this with just a `Process`. I have had success using QAliber (an automation framework) to do this exact sort of thing. To be honest, its not simple to use though. – Blake Thingstad Oct 10 '17 at 18:54

1 Answers1

0

You may be able to log in using SendKeys. Try something like this using whatever combination of \t and {enter} you need to tab from each input option giving the control focus (and thus allowing for it to type). This opens notepad, waits a little for notepad to open, and then types "username", a tab character, "password", a tab character and then enter.

var info = new ProcessStartInfo() { FileName = "Notepad.exe" };
new Process() { StartInfo = info }.Start();
System.Threading.Thread.Sleep(500);
System.Windows.Forms.SendKeys.SendWait("username\tpassword\t{enter}");

You may be able to use Process.WaitForInputIdle(int) instead of Thread.Sleep(int) depending on the application you're starting.

Blake Thingstad
  • 1,639
  • 2
  • 12
  • 19