Reputation: 19
I am new to rails and have never use angular js. I want to extract price and seller name from this link link
module HomesHelper
require 'selenium-webdriver'
require 'mechanize'
require 'nokogiri'
require 'phantomjs'
require 'watir'
b = Watir::Browser.new(:phantomjs)
b.goto url
doc = Nokogiri::HTML(b.html)
Upvotes: 0
Views: 1588
Reputation: 7366
You don't need to add Nokogiri
or mechanize
here. watir
will get all element you want. Try run below code, It will solve your issue.
require 'selenium-webdriver'
require 'phantomjs'
require 'watir'
browser = Watir::Browser.new :phantomjs
browser.window.maximize
browser.goto "https://paytm.com/shop/p/gionee-e7-mini-black-MOBGIONEE-E7-MIHAPP44414CBBDB36C?psearch=organic|undefined|gionee%20e7|grid"
puts browser.div(:class => 'profile-description').a.h2.text
puts browser.div(:class => 'buy-bar').button.span.text
puts browser.div(:class => 'effPrc').span.text
browser.close
Upvotes: 1