Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interacting with web pages in C#

There is a website that was created using ColdFusion (not sure if this matters or not). I need to interact with this web site. The main things I need to do are navigate to different pages and click buttons.

I have come up with two ideas on how to do this. The first is to use the WebBrowser control. With this, I could certainly navigate pages, and click buttons (According to This).

The other way is to interact with the html directly. Not sure exactly how to do this, but I am assuming I could click buttons or use HTML requests to interact with the page.

Does anyone have a recommendation on which way is better? Is there a better way that I haven't thought of?

like image 442
user489041 Avatar asked Jan 26 '12 16:01

user489041


People also ask

Can you use C for websites?

LibOnion is a lightweight C library that helps create web servers in the C programming language. It's based on request handlers that it uses to process all requests. The handlers may be nested, creating onion-like layers. The first layer will generally check the server name.

Can you run C++ code on a website?

While a dedicated or virtual dedicated server would be ideal for most sites (not just with C++ sites), you can, in most cases, use C++ with shared hosting. Any web host that supports CGI (which is likely all of them) will also support websites built with C++.

What is the special program to open website?

The correct answer is Web browser. A web browser is a software program that allows us to access the Internet and view web pages on our computer.


2 Answers

why not submit directly the url? that's what the button click will do. using WebRequest.Create you can submit directly to the url. no need to load, parse and "click" the button.

like image 71
Jason Meckley Avatar answered Oct 05 '22 03:10

Jason Meckley


Did you consider Selenium? The WebDriver API is quite good, and permits a lot of things in terms of Website automation.

like image 41
Vinzz Avatar answered Oct 05 '22 02:10

Vinzz