Takahiro Yamaguchi
2012-Aug-08 07:35 UTC
[Mechanize-users] [Question] my script with mechanize doesn''t fill password field for login
I''m Takahiro. My environment is as follows: yama at roswell:~/tmp$ uname -a Linux roswell 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:50:42 UTC 2011 i686 i686 i386 GNU/Linux yama at roswell:~/tmp$ ruby --version ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux] mechanize v2.5.1-9 I''m trying to login <https://ssl.naver.jp/login?fromUrl=http%3A%2F%2Fndrive.naver.jp%2F> with mechanize. I wrote the script for it. My script puts email field with value "tako" I specified,but doesn''t put password I specified. The following is a snip of my script outputs. # this puts out as follows: #<div class="mdInputTxt03Inner mdInputTxt03UserName"><input type="text" class="mdInputTxt03Input hasPlaceholder" value="tako" id="_email" name="email" tabindex="1"></div> "tako" is specified for email field in scipt is found. #<div class="mdInputTxt03Inner mdInputTxt03Password"><input type="password" class="mdInputTxt03Input hasPlaceholder" value="" id="_passwd" name="password" maxlength="20" tabindex="2"></div> password vailue is "". Could you tell me what points are wrong? Here is my script. yama at roswell:~/tmp$ cat ndrive.rb #! /usr/bin/ruby # reference http://q.hatena.ne.jp/1213335523#a834923 require ''rubygems'' require ''mechanize'' agent = Mechanize.new # NAVER URL page = agent.get(''https://ssl.naver.jp/login?fromUrl=http%3A%2F%2Fndrive.naver.jp%2F'') # print form form = page.forms.first #form.fields.each { |f| puts f.name } # this puts out as follows: #rsaKeyName #fromUrl #encryptedLoginParam #enc #email #password # set for login authentication form[''email''] = "tako" form[''password''] = "xxxx" # submit form.submit #puts page.body puts agent.page.body -- Takahiro Yamaguchi
Takahiro Yamaguchi
2012-Aug-08 07:39 UTC
[Mechanize-users] [Question] my script with mechanize doesn''t fill password field for login
I''m Takahiro. My environment is as follows: yama at roswell:~/tmp$ uname -a Linux roswell 3.0.0-12-generic #20-Ubuntu SMP Fri Oct 7 14:50:42 UTC 2011 i686 i686 i386 GNU/Linux yama at roswell:~/tmp$ ruby --version ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux] mechanize v2.5.1-9 I''m trying to login <https://ssl.naver.jp/login?fromUrl=http%3A%2F%2Fndrive.naver.jp%2F> with mechanize. I wrote the script for it. My script puts email field with value "tako" I specified,but doesn''t put password I specified. The following is a snip of my script outputs. # this puts out as follows: #<div class="mdInputTxt03Inner mdInputTxt03UserName"><input type="text" class="mdInputTxt03Input hasPlaceholder" value="tako" id="_email" name="email" tabindex="1"></div> "tako" is specified for email field in scipt is found. #<div class="mdInputTxt03Inner mdInputTxt03Password"><input type="password" class="mdInputTxt03Input hasPlaceholder" value="" id="_passwd" name="password" maxlength="20" tabindex="2"></div> password vailue is "". Could you tell me what points are wrong? Here is my script. yama at roswell:~/tmp$ cat ndrive.rb #! /usr/bin/ruby # reference http://q.hatena.ne.jp/1213335523#a834923 require ''rubygems'' require ''mechanize'' agent = Mechanize.new # NAVER URL page = agent.get(''https://ssl.naver.jp/login?fromUrl=http%3A%2F%2Fndrive.naver.jp%2F'') # print form form = page.forms.first #form.fields.each { |f| puts f.name } # this puts out as follows: #rsaKeyName #fromUrl #encryptedLoginParam #enc #email #password # set for login authentication form[''email''] = "tako" form[''password''] = "xxxx" # submit form.submit #puts page.body puts agent.page.body -- Takahiro Yamaguchi