HttpClient, how to click button on website in tests - c#

I have page where i have button which makes ajax-request to server and load simple modal form. I have one input and one button in form.
How i can test it on C# ?
I need just navigate to link -> click -> load form. Then just input text and click button.
I dont want use selenium for it.

Thx, it really only selenium. So i just need to use it.

Related

Redirecting to the previous screen inside of a Dialog

I have a custom Dialog with 4 linked screens(which come one by one on click of a Continue button) in my ASP.Net MVC application. On the 2nd screen, the user has an option to click a button which re-directs him to a entirely different screen(but inside the Dialog). Here there is a Save button. I want the user to go back to the 2nd screen when the Save is done but the Dialog is getting closed(redirecting to the landing page from where the Dialog was thrown initially. I'm doing a return Redirect(Request.UrlReferrer.ToString()); on click of the Save button but it clearly doesn't work the way I want it to.
How can I make the user stay on the Dialog? Can you please help me with the fix?

How to add multiple web links on a button in c#?

How to add multiple web links behind a single button in C#, so that web link always change whenever I click on the button and browser open next link on every click on the button?

Keyboard Shortcut on asp.net Button

I want to apply the keyboard shortcut Ctrl+W (closes a browser tab) on an asp.net button. When I click on the asp.net button, it should work like the above controls. Is it possible? And if it is, from where can I get the code for Ctrl+W(close a browser tab).
window.close() won't work to close a browser's tab.
Simply put: it won't work, because you cannot close the current page with JavaScript (well, you can do it from your own developer console, but not from a script). Please take a look at this question for details: window.close and self.close do not close the window in Chrome

AjaxFileUpload hide upload button and handle manually the upload?

I want to use AjaxFileUpload control:
I am reviewing this, and the functionality I need is to hide the upload button, and save all buttons from another button click event.
Is it possible to do?
According to the properties they show, I dont see an option to hide the button.
Looking at the source html, it seems that doing:
$('.ajax__fileupload_uploadbutton').hide();
Will do the trick of hiding the Upload button. The problem remains, though, as to whether an event is triggered when the user drops the first file or selects it via the Select button. I am sure there's one you can hook into to just call the above line of code (using jQuery on my example).
You can implement the same with pure Javascript.

Is there TAB control and how to open page2 from button click?

Is there TAB control and how to open page2 from button click ?
On asp.net ?
I work with C# and Visual Studio 2008 and ASP.NET
Thanks in advance
The standard ASP.NET controls that ship with the .NET Framework do not include a tab control. However you can find a number of implementations on the internet, I would suggest you look the jQuery UI.
As for the button click redirecting to page2 you can handle the button click event on the server side and use a Response.Redirect("page2.aspx") to redirect the users browser to the desired page. Other alternatives exist like using an anchor (link) which will request the second page directly.
Set the SelectedTab property to the index of the tab you want to display in the click event of your button.

Categories