Extractor patter for option value
Hi all-
Its been awhile since I posted last. I am working on a scrape for customer, but for the life of me I can not figure out the right extractor pattern to use to get the value from
Here is the code
<div class="row selectTruckWrapper "><label for="selectTruckalias" class="left optional">Find by name:</label>
<div class="element"><select name="selectTruckalias" id="selectTruckalias" class="selectTruck autosuggest hiddenIfJsEnabled">
<option value="" label="----------">----------</option>
<option value="sttoroll" label="1st To Roll Industry Catering">1st To Roll Industry Catering</option>
<option value="sphillycheese" label="30sPhilly Cheese">30sPhilly Cheese</option>
<option value="4505meats" label="4505 Meats">4505 Meats</option>
<option value="achefsburger" label="A Chefs Burger">A Chefs Burger</option>
<option value="adobohobocart" label="Adobo Hobo Cart">Adobo Hobo Cart</option>
<option value="aladdinmiddleeastern" label="Aladdin Middle Eastern">Aladdin Middle Eastern</option>
<option value="alamedapietruck" label="Alameda Pie Truck">Alameda Pie Truck</option>
<option value="alebrijesgrill" label="Alebrije's Grill">Alebrije's Grill</option>
<option value="allfiredup" label="All Fired Up">All Fired Up</option>
<option value="Annakoot" label="Annakoot">Annakoot</option>
<option value="archiesicecream" label="Archie's Ice Cream">Archie's Ice Cream</option>
<option value="AroyD_4ccf2a923b9e4" label="Aroy-D">Aroy-D</option>
<option value="artichokebliss" label="Artichoke Bliss">Artichoke Bliss</option>
<option value="ashkaseastmeetswest" label="Ashkas East Meets West">Ashkas East Meets West</option>
<option value="AsianSoulKitchen" label="Asian Soul Kitchen">Asian Soul Kitchen</option>
<option value="auntstellessnowcone" label="Aunt StelleÕs Snow Cone">Aunt StelleÕs Snow Cone</option>
<option value="AustinDailyPress" label="Austin Daily Press">Austin Daily Press</option>
<option value="authentictacos" label="Authentic Tacos">Authentic Tacos</option>
<option value="bandjscart" label="B&J's Cart">B&J's Cart</option>
<option value="BabysBadassBurgers" label="BabyÕs Badass Burgers">BabyÕs Badass Burgers</option>
<option value="Bananarchy" label="Bananarchy Stand">Bananarchy Stand</option>
</select></div>
</div>
<div class="element"><select name="selectTruckalias" id="selectTruckalias" class="selectTruck autosuggest hiddenIfJsEnabled">
<option value="" label="----------">----------</option>
<option value="sttoroll" label="1st To Roll Industry Catering">1st To Roll Industry Catering</option>
<option value="sphillycheese" label="30sPhilly Cheese">30sPhilly Cheese</option>
<option value="4505meats" label="4505 Meats">4505 Meats</option>
<option value="achefsburger" label="A Chefs Burger">A Chefs Burger</option>
<option value="adobohobocart" label="Adobo Hobo Cart">Adobo Hobo Cart</option>
<option value="aladdinmiddleeastern" label="Aladdin Middle Eastern">Aladdin Middle Eastern</option>
<option value="alamedapietruck" label="Alameda Pie Truck">Alameda Pie Truck</option>
<option value="alebrijesgrill" label="Alebrije's Grill">Alebrije's Grill</option>
<option value="allfiredup" label="All Fired Up">All Fired Up</option>
<option value="Annakoot" label="Annakoot">Annakoot</option>
<option value="archiesicecream" label="Archie's Ice Cream">Archie's Ice Cream</option>
<option value="AroyD_4ccf2a923b9e4" label="Aroy-D">Aroy-D</option>
<option value="artichokebliss" label="Artichoke Bliss">Artichoke Bliss</option>
<option value="ashkaseastmeetswest" label="Ashkas East Meets West">Ashkas East Meets West</option>
<option value="AsianSoulKitchen" label="Asian Soul Kitchen">Asian Soul Kitchen</option>
<option value="auntstellessnowcone" label="Aunt StelleÕs Snow Cone">Aunt StelleÕs Snow Cone</option>
<option value="AustinDailyPress" label="Austin Daily Press">Austin Daily Press</option>
<option value="authentictacos" label="Authentic Tacos">Authentic Tacos</option>
<option value="bandjscart" label="B&J's Cart">B&J's Cart</option>
<option value="BabysBadassBurgers" label="BabyÕs Badass Burgers">BabyÕs Badass Burgers</option>
<option value="Bananarchy" label="Bananarchy Stand">Bananarchy Stand</option>
</select></div>
</div>
You need
You need scrapeableFile.extractData().
Jason Thanks for the hint. I
Jason
Thanks for the hint. I tried busing extract data, but no luck. Maybe I am not using it correctly?
Would need to see how you're
Would need to see how you're using it, but a brief overview would be that you have 2 extractor patterns. One isolates the pulldown menu you want. Something like:
~@ALL_OPTIONS@~
</select>
On this extractor you will have a script like:
for (i=0; i<options.getNumDataRecords(); i++)
{
dr = options.getDataRecord(i);
option = dr.get("OPTION");
session.setv("OPTION", option);
}
And the last extractor is named "Extractor pattern" (as referenced above), and looks a little like:
So the first patten isolates a block of text, and the script calls the 2nd pattern on only the isolated part of the page.
Does that help?