311
Views
4
Comments
[NScrape Web Scraping] Fill input and to click on a button
Question
nscrape-web-scraping
Service icon
Forge asset by André Vieira


Hello,


I'm trying to do web scraping in a page that requires validation, that is, I have to add some data to a form, click on a button and scrap the page loaded after that. 

I don't know how to fill the fields and to click with the extension.

2020-03-05 15-52-45
André Vieira
Staff

Hi Julio,

You have two methods in the extension to scrape pages that have forms, either an HTML form or ASPX webform. Each method receives a list of inputs as a parameter, each of which you will have to provide the name (of the input) and the value you want the input to have.

UserImage.jpg
julio alvarez

Hi André!

The exact sequence I should make is:

  1. Navigate to page. (Ok, that's easy).
  2. Click on a button of loaded page. How I click on a button with extension methods?
  3. The click on button navigate to another URL. How I get the page loaded after that? The new page loaded after navigation is in HtmlDocumentNode of initial HtmlDocument_Load method?
  4. Fill a form. This is OK, with ScrappeHtml_form method you told me.


So, how I make click on a button of scrapped page and then how I get the page loaded after that?


Thx again,

Julio

2020-03-05 15-52-45
André Vieira
Staff

If the first button only navigates to the second page you should be able to get that URL and use it. I don't think the library has the ability to click on buttons.

UserImage.jpg
julio alvarez

Sorry, I can't navigate directly to second page, because link en firts is dinamically generated; besides, second page needs cookie and session info generated in first, so I need simulate navigate to the first, and after that, make click on a button to go to the second.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.