0

I am pretty new to this forum, sorry if this has already been answered. However, I am trying to accomplish being logged into a site and click a button without using the web browser as it has its memory leak. I got no idea how to step ground on this and I am fine with using external libraries.

  • You could write c# code to submit form - https://stackoverflow.com/a/43158324/1554116 – Ray Krungkaew Dec 07 '17 at 02:35
  • I need to click a element not submit the fourm, sadly the button isnt a submit form... – Logan Risen Dec 07 '17 at 02:37
  • If it is a kind of HTTP requests, c# can simulate all of that. Probably you could start with capturing the request message, and then we can help from there. – Ray Krungkaew Dec 07 '17 at 02:41
  • Will do once I finish my school work. – Logan Risen Dec 07 '17 at 02:42
  • @RawitasKrungkaew like this? `HttpClient client = new HttpClient(new LoggingHandler(new HttpClientHandler())); HttpResponseMessage response = client.PostAsJsonAsync(baseAddress + "/api/values", "Hello, World!").Result;` – Logan Risen Dec 07 '17 at 02:46
  • Add this code as a part of question. Adding what you have already done and where are you stuck makes it easy to understand. – Sunil Dec 07 '17 at 02:48
  • You might need Fiddler to capture the HTTP request message – Ray Krungkaew Dec 07 '17 at 02:49
  • Im just looking for a way to click a element without using webbrowser.... – Logan Risen Dec 07 '17 at 03:00
  • You could try using Selenium with Phantom Driver or Headless Chrome Driver – Ray Krungkaew Dec 07 '17 at 03:06
  • @Logan Risen You have to Post _all_ of that WebForm Names and Values, including the name of the button which causes the form action. It's also possible that those names have to be URL encoded, since they might contain "weird" characters. To know the names ot those elements, you have to parse the html page you get from the first response. Or, you can use any major browser with Developer Tools and see what parameters are passed when you Post the form. – Jimi Dec 07 '17 at 03:08

0 Answers0