nvreynolds / refract Goto Github PK
View Code? Open in Web Editor NEWCrawler that auto generates SitePrism Page Objects
Home Page: https://rubygems.org/gems/refract
License: MIT License
Crawler that auto generates SitePrism Page Objects
Home Page: https://rubygems.org/gems/refract
License: MIT License
irb(main):002:0> require 'refract'
=> true
irb(main):003:0> Refract.create('https://facebook.com')
Traceback (most recent call last):
16: from /home/anchavan/.rbenv/versions/2.5.1/bin/irb:11:in <main>' 15: from (irb):3 14: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/refract-0.0.0/lib/refract.rb:7:in
create'
13: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/spidr.rb:53:in site' 12: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent.rb:274:in
site'
11: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent.rb:355:in start_at' 10: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent.rb:373:in
run'
9: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent.rb:665:in visit_page' 8: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent.rb:599:in
get_page'
7: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent.rb:788:in prepare_request' 6: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent.rb:605:in
block in get_page'
5: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent.rb:669:in block in visit_page' 4: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent.rb:669:in
each'
3: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent.rb:669:in block (2 levels) in visit_page' 2: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/spidr-0.6.0/lib/spidr/agent/events.rb:233:in
block in every_html_page'
1: from /home/anchavan/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/refract-0.0.0/lib/refract.rb:9:in block (2 levels) in create' NoMethodError (undefined method
downcase' for nil:NilClass)
irb(main):004:0> clear
Traceback (most recent call last):
2: from /home/anchavan/.rbenv/versions/2.5.1/bin/irb:11:in <main>' 1: from (irb):4 NameError (undefined local variable or method
clear' for main:Object)
Did you mean? caller
Hi, Im testing your gem and the generated output resembles nothing like page objects. I'm kinda missing some documentation. Could you please provide explanation and maybe some snippet how does it work on your side?
[2] pry(main)> Refract.create('www.twitter.com')
NoMethodError: undefined method `+' for nil:NilClass
from /Users/name/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/http.rb:1561:in `addr_port'
[3] pry(main)> Refract.create('https://twitter.com')
page object not created for https://twitter.com/i/directory/profiles
page object not created for https://twitter.com/settings/personalization
page object not created for https://twitter.com/account/complete
^CInterrupt:
from /Users/name/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/net/protocol.rb:158:in `wait_readable'
[4] pry(main)> Refract.create('https://google.com')
=> #<Spidr::Agent:0x007f8564a4f150
@authorized=#<Spidr::AuthStore: {}>,
@cookies=#<Spidr::CookieJar: {}>,
@default_headers={},
@delay=0,
@every_failed_url_blocks=[],
@every_link_blocks=[],
@every_page_blocks=[#<Proc:0x007f8564a4e6b0@/Users/name/.rvm/gems/ruby-2.3.0/gems/spidr-0.6.0/lib/spidr/agent/events.rb:232>],
@every_url_blocks=[],
@every_url_like_blocks={},
@ext_rules=#<Spidr::Rules:0x007f8564a4e8b8 @accept=[], @reject=[]>,
@failures=#<Set: {}>,
@history=#<Set: {#<URI::HTTPS https://google.com>}>,
@host_header=nil,
@host_headers={},
@host_rules=#<Spidr::Rules:0x007f8564a4eb38 @accept=["google.com"], @reject=[]>,
@levels={#<URI::HTTPS https://google.com>=>0},
@limit=nil,
@link_rules=#<Spidr::Rules:0x007f8564a4e9f8 @accept=[], @reject=[]>,
@max_depth=nil,
@paused=false,
@port_rules=#<Spidr::Rules:0x007f8564a4ea98 @accept=[], @reject=[]>,
@queue=[],
@referer=nil,
@running=false,
@schemes=["http", "https"],
@sessions=
#<Spidr::SessionCache:0x007f8564a4f0d8
@continue_timeout=nil,
@keep_alive_timeout=nil,
@open_timeout=nil,
@proxy=#<struct Spidr::Proxy host=nil, port=8080, user=nil, password=nil>,
@read_timeout=nil,
@sessions={},
@ssl_timeout=nil>
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.