Navigate a url with asp dropdownlist ?

Questions and answers about anything related to Helium Scraper
Post Reply
derba
Posts: 27
Joined: Tue May 15, 2012 8:03 pm

Navigate a url with asp dropdownlist ?

Post by derba » Wed May 16, 2012 10:24 am

Hello,

This is my first post ! I am still in my trial period. So far I think Helium Scraper is good piece of software. ;)

Here is my problem :
I have a dropdownlist on a webpage (I have the choice between "A" or "B" which changes the main browser url).
How can I tell Helium to Navigate from "A" (website.com/dd.asp?&period=A) to "B" (website.com/dd.asp?&period=B) ?

I have successfully created a kind which select the image containing the dropdownlist.
HTML Inner Code :

Code: Select all

<select onchange="change_s_period('keyword', this.value);"><option selected="selected" value="A">Anv</option><option value="B">Bert</option></select>
I also created a JavaScript gatherers (thanks to the graphical replace function) named "JS_change_from_A_to_B"

Code: Select all

var step0_result = element.outerHTML.replace(/\r\n/g, "\n");
var step1_result = step0_result.replace(new RegExp("<option\\ selected=\"selected\"\\ value=\"A\">Anv</option><option\\ value=\"B\">Bert</option></select>", "g"), "<option value=\"A\">Anv</option><option selected=\"selected\" value=\"B\">Bert</option></select>");

return step1_result;
But I have no clue of where do I tell Helium Scraper to navigate to the new url (I tried to in the Actions section but I see no option) ! ;(

Thanks in advance for any help ;)

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

Re: Navigate a url with asp dropdownlist ?

Post by webmaster » Thu May 17, 2012 5:30 am

If you have a kind that selects the drop down and your gatherer will give you the new URL from the drop down, then all you'd need to do is add a Select Kind action that selects your drop down kind, and then a Execute JavaScript with this code:

Code: Select all

var dropDown = Global.Browser.Selection.GetItem(0);
window.location.href = Global.Gather("JS_change_from_A_to_B", dropDown);
You might want to try something like

Code: Select all

var dropDown = Global.Browser.Selection.GetItem(0);
alert(Global.Gather("JS_change_from_A_to_B", dropDown));
just to make sure everything is working OK (this last code should display a message box with the URL instead of navigating to it).
Juan Soldi
The Helium Scraper Team

derba
Posts: 27
Joined: Tue May 15, 2012 8:03 pm

Re: Navigate a url with asp dropdownlist ?

Post by derba » Thu May 17, 2012 8:38 pm

Hi,
Many thanks ! This is working great. ;)
See ya

Post Reply