[FIXED, NOT ISSUE] Mechanize - Use with bad coded HTML

Hi, I’m new to Ruby and Mechanize and I’m making a script to update a
database based on the data scraped out of a website. This website is
badly coded and I don’t have access to correct the issue, so I’ve been
having a lot of headaches because of it. My current issue is a select
tag with the selected attribute of the options. If I do a

form.field_with(:name => ‘my_select’).value

then the returned value is always the first value ignoring the selected
option. When I searched on the html code I see the selected option with
the attribute selected but with empty string, like so:

My Option

I was wondering if there is a way to get all attributes from the option
node so I can look for the option that has the selected attribute even
if it’s empty?

If this is a rookie question, please let me know, I’ve been searching
all over the web and can’t find an explicit way.


Never mind, it seems I’m not scraping correct page and I’m clicking the
wrong link. Thanks though.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs