capybara - how can I get the content generated by javascript -


i want use capybara fetch content of remote site has list , content of list generated javascript how can these content? require "capybara" require "capybara/mechanize" require "capybara-webkit" require "ko_spider/proxy/proxy"

module kospider   class corespider     include capybara::dsl     def initialize(wait=10)         proxy = proxy.new         capybara.configure |conf|             conf.run_server              = false             conf.app                     = ''             conf.javascript_driver       = :webkit             conf.default_driver          = :mechanize             conf.current_driver          = :mechanize             conf.default_wait_time       = wait                     conf.ignore_hidden_elements  = false             conf.current_session.driver.browser.agent.user_agent_alias = 'mac safari'             conf.current_session.driver.browser.agent.set_proxy(proxy.host,proxy.port)         end         super()     end       def get_proxy_by_url(url)         visit(url)         page.all(:css, 'table.tb tbody tr').each |tr|             host = ''             port = ''             tr.all('td').each_with_index |td,idx|                 host = td.text if idx == 1                 port = td.text if idx == 2             end             puts "=========#{host}:#{port}==========="         end     end    end end 

and want host , port use method get_proxy_by_url @ this page @ colums of port of them generated javascripts how can them

as can see, in get_proxy_by_url method try text of port can't those, , want know if capybara can them


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -