I tried the below code:
require 'mechanize'
agent = Mechanize.new{|a| a.ssl_version, a.verify_mode = 'SSLv3',
OpenSSL::SSL::VERIFY_NONE}
page = agent.get "https://www.google.com/"
page=page.link_with(:dom_class => "button").click()
But my bad getting the below error within my company,but the same was
running in my home desktop well. Any suggestion how to break
firewall/stie blocker and do the work in company also?
D:\WIPData\Ruby\Scripts>mechanize_dowload.rb
C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.8/lib/net/http/persist
ent/ssl_reuse.rb:29:in `initialize': getaddrinfo: No such host is
known. (Socke
tError)
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.8/lib/net
/http/persistent/ssl_reuse.rb:29:in `open'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.8/lib/net
/http/persistent/ssl_reuse.rb:29:in `block in connect'
from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout'
from C:/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.8/lib/net
/http/persistent/ssl_reuse.rb:29:in `connect'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start'
from C:/Ruby193/lib/ruby/1.9.1/net/http.rb:750:in `start'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.8/lib/net
/http/persistent.rb:628:in `start'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.8/lib/net
/http/persistent.rb:570:in `connection_for'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.8/lib/net
/http/persistent.rb:926:in `request'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mechanize-2.5.1/lib/mechanize/h
ttp/agent.rb:258:in `fetch'
from
C:/Ruby193/lib/ruby/gems/1.9.1/gems/mechanize-2.5.1/lib/mechanize.r
b:407:in `get'
from D:/WIPData/Ruby/Scripts/mechanize_dowload.rb:5:in
`<main>'
D:\WIPData\Ruby\Scripts>
The same script ran perfectly on my personal machine,but not in my
company.
Could you please me to fix the same?
Thanks in advance
on 2013-01-22 15:52
on 2013-01-22 17:25
On Tue, Jan 22, 2013 at 3:52 PM, Arup Rakshit <lists@ruby-forum.com> wrote: > The same script ran perfectly on my personal machine,but not in my > company. > > Could you please me to fix the same? Maybe it's the DNS setup on the company machine or how Ruby interacts with DNS there. Kind regards robert
on 2013-01-22 18:53
Robert Klemme wrote in post #1093173: > On Tue, Jan 22, 2013 at 3:52 PM, Arup Rakshit <lists@ruby-forum.com> > wrote: > Maybe it's the DNS setup on the company machine or how Ruby interacts > with DNS there. > > Kind regards > > robert The link is opened and workable on my each browser - 'IE-9','firefox' both. But it is not with the script as mentioned above. So any work around on that? Really it is painful for me. This Gem has good fetures,but couldn't use it. The same problem with "Nokogiri" also. Thanks,
on 2013-01-22 21:05
On Tue, Jan 22, 2013 at 6:53 PM, Arup Rakshit <lists@ruby-forum.com> wrote: > Robert Klemme wrote in post #1093173: >> On Tue, Jan 22, 2013 at 3:52 PM, Arup Rakshit <lists@ruby-forum.com> >> wrote: > >> Maybe it's the DNS setup on the company machine or how Ruby interacts >> with DNS there. > The link is opened and workable on my each browser - 'IE-9','firefox' > both. But it is not with the script as mentioned above. So any work > around on that? Really it is painful for me. This Gem has good > fetures,but couldn't use it. The same problem with "Nokogiri" also. Nokogiri will not open remote connections. It's just for parsing XML, HTML and the like. Unless I am overlooking something. Did you try to open a connection to that port using TCPSocket to verify the underlying mechanics work? Kind regards robert
on 2013-01-22 21:46
Robert Klemme wrote in post #1093191: > On Tue, Jan 22, 2013 at 6:53 PM, Arup Rakshit <lists@ruby-forum.com> > wrote: >> Robert Klemme wrote in post #1093173: >>> On Tue, Jan 22, 2013 at 3:52 PM, Arup Rakshit <lists@ruby-forum.com> >>> wrote: >> >>> Maybe it's the DNS setup on the company machine or how Ruby interacts >>> with DNS there. > I didn't get you. cloud you explain the syntax or give me a sample code which you want me to do eliminate the error? Thanks, Arup
on 2013-01-23 02:49
On Wed, Jan 23, 2013 at 1:53 AM, Arup Rakshit <lists@ruby-forum.com> wrote: > > The link is opened and workable on my each browser - 'IE-9','firefox' > both. But it is not with the script as mentioned above. So any work > around on that? Really it is painful for me. This Gem has good > fetures,but couldn't use it. The same problem with "Nokogiri" also. > check if you're behind a proxy kind regards -botp
on 2013-01-23 05:37
botp wrote in post #1093207: > On Wed, Jan 23, 2013 at 1:53 AM, Arup Rakshit <lists@ruby-forum.com> > wrote: > >> >> The link is opened and workable on my each browser - 'IE-9','firefox' >> both. But it is not with the script as mentioned above. So any work >> around on that? Really it is painful for me. This Gem has good >> fetures,but couldn't use it. The same problem with "Nokogiri" also. >> > > check if you're behind a proxy > > kind regards -botp Yes,We are using `Proxy`. Is the proxy only reason for that error? how I need to set proxy with my script? Thanks, Arup
on 2013-01-24 15:29
Arup Rakshit wrote in post #1093223: > botp wrote in post #1093207: >> On Wed, Jan 23, 2013 at 1:53 AM, Arup Rakshit <lists@ruby-forum.com> >> wrote: >> >>> >>> The link is opened and workable on my each browser - 'IE-9','firefox' >>> both. But it is not with the script as mentioned above. So any work >>> around on that? Really it is painful for me. This Gem has good >>> fetures,but couldn't use it. The same problem with "Nokogiri" also. >>> Is there anyway I can eliminate all the above errors and can work with "mechanize" inside the "firewall"? Thanks,
on 2013-01-24 16:31
Arup Rakshit wrote in post #1093518: > Is there anyway I can eliminate all the above errors and can work with > "mechanize" inside the "firewall"? If your browser works you can use webdriver with the browser and its default profile, and then let Nokogiri handle the HTML once you've aquired the target page.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.