C#

Click Menu Automatically Using Web Scrapping In C#

In this article, We will learn how to open a browser and run a URL using Web Scraping.

What is Web Scrapping?

  • Web scraping is the technique of extracting data from a website using bots.
  • Web scrapers allow you to extract data from websites automatically, saving you or your coworkers time that would otherwise be spent on tedious data collection chores. It also means that you can collect data in far bigger quantities than a single human could.

Note:  This is only for learning purposes. We do not motivate you to breach the terms of any website. So please use it for legal purposes only.

  • Let us understand with help of an example.

First, create a console project and will install three NuGet packages which are required for Web Scrapping.

Selenium.Support

Selenium.WebDriver

Selenium.WebDriver.ChromeDriver

  • Then you have to add your current browser version of chromedriver.exe and add in your project folder, you can download it from here.
  • For example, my current chrome version is 99.0.4844.51


  • Then open the Program.cs file and add this code.
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using System;

namespace WebScrapping
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                ChromeDriver driver = new ChromeDriver(@"D:\Parth Mandaliya\WenScrapping\WenScrapping\Driver"); // add your chromedriver.exe path here
                driver.Manage().Window.Maximize();
                driver.Navigate().GoToUrl("http://staging.thecodehubs.com/");
                driver.FindElement(By.Id("menu-item-13558")).Click();
            }
            catch (Exception ex)
            {
            }
        }
    }
}

Output

Hope you guys found something useful. Please give your valuable feedback and If you have any queries about this article then you can ask me in the comment section.

Also, check http://staging.thecodehubs.com/how-to-install-kioware-client-and-setup/

Parth Mandaliya

Parth Mandaliya is a Web Developer and Author at TheCodeHubs. He has got his skills in working on technologies like C#, NET, .ASP.NET MVC, ASP.NET Core, CSS, Entity Framework, Bootstrap, HTML, JavaScript, ADO.NET, AJAX, JQuery, LINQ, Angular, Nhibernate, Web API, SQL Server, and different integration like PayKUN payment, RazorPay Payment, Kioware browser, BigCommerce, Overstock, Etsy, Wish, Magento, Tundra, Faire.

Recent Posts

Testing hk

Testing

1 year ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

1 year ago

Operation

Testing

1 year ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

1 year ago

Create and Used PIPE in angular

In this article, we have to show Create and Used PIPE in angular

1 year ago

TETS NEW

test

2 years ago