Jump to content

C# bot to get all item by id

- - - - -

  • Please log in to reply
3 replies to this topic

#1
naoru

naoru

    Newbie

  • Members
  • Pip
  • 2 posts
Hi
im making a bot that clicks on buttons on a webpage
the number of buttons varies according to the search criteria
how to make the bot press the button

each button is recognized by the following id
<a id ctl00_content_SearchResultJobOffers_gridJobOffers_ ApplyToJobOffer0_button

and the following button
ctl00_content_SearchResultJobOffers_gridJobOffers_ ApplyToJobOffer1_button

i want to make a foreach loop but dont know how to let the program know the number of items

thanks

#2
LuthfiHakim

LuthfiHakim

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 763 posts
Couldn't you just parse the html content? Or perhaps you could just search for specific ids?

#3
sam_coder

sam_coder

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 372 posts
you should check out the HtmlAgilityPack, it allows you to turn the HTML page into an HtmlDocument, that mirrors XmlDocument in almost every way. it even allows you to use XPath, even if the document isn't valid XML (like no closing tags for example).

Html Agility Pack

#4
naoru

naoru

    Newbie

  • Members
  • Pip
  • 2 posts
Hi guys
thanks for the reply
basicaly after doing search the page displays
"search returned X results"

so i could get the X from there using substring
but i was looking for a more elegant solution

i will check the html agility pack - thanks for the tip




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users