Mechanize ASP page breaks

require 'mechanize'
agent = Mechanize.new
login = agent.get('http://www.schoolnet.ch/DE/HomeDE.htm')
agent.click login.link_with text: /Login/

And I get it Mechanize::UnsupportedSchemeError.

+5
source share
2 answers

Mechanize did'nt supports javascript, but you can add a search field to the form to specify a search term for it and submit the form using mechanize

form = page.forms.first
form.add_field! "Field_name here","BotM$ucUser$ucUser2Col$cmdLogin"
page = form.submit
+9
source

The link in question uses the javascript function.

<a href="javascript:__doPostBack('BotM$ucUser$ucUser2Col$cmdLogin','')" id="BotM_ucUser_ucUser2Col_cmdLogin">Login</a>

The mechanism does not support javascript links. Someone suggests using Harmony.

Check out https://github.com/mynyml/harmony

+1
source

All Articles