example of IF

Questions & Answers about Helium Scraper 3
Post Reply
codetwist
Posts: 1
Joined: Sat Jan 04, 2020 2:58 pm

example of IF

Post by codetwist » Tue Apr 20, 2021 11:01 am

Hello.
Is there any example of the IF command and how we use it?
I want to extract some data IF the header have specific text is possible? if yes how to?
Thank you

webmaster
Site Admin
Posts: 510
Joined: Mon Dec 06, 2010 8:39 am
Contact:

Re: example of IF

Post by webmaster » Wed Apr 21, 2021 5:44 pm

If this is an element on a page, such as a title, you first need to create a selector that selects this element (suppose you call it Header), and then use the following code:

Code: Select all

Sequence.IfAny
   ·  Select.Header
   ·  [ifAny]
   ·  Sequence.Empty
Then just replace [ifAny] with whatever actions extract from the page, such as an extract action:

Code: Select all

Sequence.IfAny
   ·  Select.Header
   ·  extract
         header
            Select.Header
         description
            Select.Description
         price
            Select.Price
   ·  Sequence.Empty
Juan Soldi
The Helium Scraper Team

Post Reply