Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to develop a webbrowser application.
When my app clicks on a link, a messagebox pops up with OK and Cancel options. I have to click OK to continue. I tried every possible way to my knowledge with no success.
SendKeys did not work.
I believe if somehow I can switch to the message window, sendkeys might work.
How can I achieve this?
Message Box is a UI element, there isn't an easy way to automate interacting with the message box. There is also the issue of using a Windows message box vs. using a JavaScript confirmation dialog.
Message Box is part of the server execution. It just so happen that in development your server and client are the same machine. So the Windows message box appears on the server (which is your local box.) if you were to deploy this to an actual server the message box would appear on the server, not the user's local machine. That' simply doesn't work for web development.
Now, you could use a JavaScript confirmation dialog. To do this you need to write/render JavaScript to the browser that will open a confirmation dialog when the body of the html is loaded. Not a good idea, but possible. Typically you want to avoid popups and dialogs when a page loads.
So your best option is to either re-design the UI so a message box is not displayed or use a different route to execute the process and bypass the UI altogether.
Assuming you're using the WebBrowser control embedded in a WIndows form named Frm, you could try calling the Activate() and Focus() methods before using SendKeys...
Frm.Activate()
Frm.Focus()
SendKeys.SendWait("{Enter}")
That has worked for me.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I'm wondering how to do the change picture feature on asp.net just like the one in facebook. When you click the image a window will pop up that let's your upload your picture. Because the asp.net file upload has a text on it "Choose file". What I want is when you click the image a pop up will appear then you can navigate to upload/change picture. I need an idea / guide on how to replicate/do this in asp.net. thank you for any help/idea.
You can use jQuery .
In this article you will see how to create Modal Popup Window using jQuery UI Modal Dialog in ASP.Net and how to display the Modal Popup Window on Button Click
And there you can find another simple jQuery UI Dialog
Hope this helped you.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have a win forms application. The form contains a third party chart from dotnetcharting. The form also has a few other controls which allows the user to select the type of chart they wish to see.
The issue I have is when the user clicks the button to plot the chart nothing appears to happen (it is though), so the chart is blank. However when I go to another application, a word document, or web page or whatever and then go back to my win forms application the chart now appears. Why is this?
Is this to do with win forms or the chart? Is there some refresh I need to do?
I think it has to do with the refreshing, please try to put the line:
Application.DoEvents();
after the data is being updated. It should then change the form.
Difficult to say without more information.
Sounds like you have to invalidate the control which sounds odd for a third party control.
Possibly there is a function on the control to tell it to redraw or that you are finished with calculating. Did you check the documentation on usage?
Some controls can be paused from updating the UI to let them handle lots of data and restarted after you finished with the data.
Post some more info on usage and code
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I am developping a Windows Phone 8 application in C#/Xaml.
When the user launched the app, he arrives on a log page and then he enters in the "real" app. My problem is: how can the user log out?
I tried to just come back on the log page by clicking on a button but then i have trouble with the back button.
Is there a way to kill the app manually?
What are the best practices to do that?
Thanks for your help!
I would try this :
A logout button wherever you want it that redirects to a xaml page stating "do you really want to logout ?" (let's call this page Logout.xaml) and in this page, you manage to redirect the user to the homepage of your app in the "Button_Click" method of your "yes" button, in the file Logout.xaml.cs.
Then, you override the OnNavigatingFrom method of the Lougout.xaml.cs file, and in this method you kill the user session.
This way, your user wants to disconnect, clicks yes, and goes back to the homepage with his session closed.
Now, if you already wanted to do that and your question is "how to kill the session ?", it depends on how you handle your user sessions
To Terminate the application you can use :
App.Current.Terminate();
There won't be any issue when using this call, but make sure you have saved all data in your app when calling this, because this call effectively kills your app immediately - ApplicationClosing even handler won't be raised after it!
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
I have an Windows Application running on my PC , this application list all connected servers on our farm .
This application have manual process (more than one step ) to do one action per server ,,
The steps are as the following (These steps are done for each one of the servers listed) :
Select one server then click right on the mouse then choose one option.
The selected option will open a new window above the parent application window.
Then click on button.
What I need is to build a new C# application that acts/simulate as the above application with ability to do that action automatic for all select servers from the list ..
I hope its clear now ,,
Please help me ..
If the application you want to attach has a UI, You can use UI Automation and Win32 API to manipulate some functinallity.
Try this starting points:
How to I get the window handle by giving the process name that is running?
Get the handle of a window with not fully known title. (C#)
http://www.csharphelp.com/2006/08/get-current-window-handle-and-caption-with-windows-api-in-c/
using C# and UI Automation to grab contents of unknown control-type
Good luck
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I need to control some third party app which has no API and very limited command line arguments.
So I need to simulate user interaction using .net and C#.
What I need to do:
start the application (this works)
enter string into appropriate edit
fields
press button
extra bonus is to hide app window
Can this be done and how ?
Thank you very much.
EDIT:
What do you think about AutoIt tool ?
You could achieve this using White.
It enables you to programmatically simulate user interaction with Win32, WinForms, WPF, Silverlight and SWT applications. I used it years ago when it first can out to automate some simple smoke tests on a WinForms application with great success.
(Caveat: this is based on my usage a while ago, so it may be slightly different now)
I created some code to launch my application and find a series of controls by name. Once found, each control could be manipulated (e.g. text entered, button clicked, etc...). To find the name of the controls, use something like Spy++ (Win32), UISpy (WinForms) or Snoop (WPF) to inspect the running application.
Theres also the UI Automation API, which, for this task, would be pretty easy to whip up.
This link will give you an idea of the support for each of the control types:UI Automation Control Types.
You can use the control name, caption or resource ID in order to grab its handle, and do what you want.
Clicking a button can be as simple as grabbing the handle and:
AutomationElement control = AutomationElement.FromHandle(controlHandle);
InvokePattern ip = (InvokePattern)control.GetCurrentPattern(InvokePattern.Pattern);
ip.Invoke();
I've had very good success with this on all .net windows, and 99% of controls from the native world