ruby - Why can't PhantomJS/Poltergeist pull up this website correctly? -
i'm using capybara navigate web page. url this:
http://www.myapp.com/page/abcxyz?page=<x> the page has paginated table on it. passing page number paginate table appropriately.
however, when using poltergeist driver, page parameter ignored.
using selenium driver not option because it's hassle run headless, doesn't want run more 1 time (gives "connection refused" error on localhost).
this looks encoding issue, i'm not sure in stack issue lies.
class verifier class << self include capybara::dsl capybara.default_driver = :poltergeist capybara.default_wait_time = 10 def parse_table(header) xpath = '//*[@id="products"]/table[3]/tbody/tr/td/div[4]/div/table' table = find(:xpath, xpath) rows = [] table.all("tr").each |row| product_hash = {} row.all("td").each_with_index |col,idx| product_hash[header[idx]] = col.text end rows << product_hash end rows end def pages page.find(".numberofresults").text.gsub(" products","").split(" ").last.to_i/25 end def import(item) visit "http://www.myapp.com/page/#{item}" header = parse_header apps = parse_vehicles(header) pages.times |pagenumber| url = "http://www.myapp.com/page/#{item}?page=#{pagenumber+1}" # problem end end end that url in last loop? processes if pagenumber not present. when change driver :selenium, whole thing works. it's not capybara issue far can see.
Comments
Post a Comment