Creating a simple scraper in Wallaby

I want to create a simple scraper in https://github.com/keathley/wallaby

Where does the function “visit” come from? In the examples it’s called without a module as it were imported or used. But it’s not imported from anywhere.

{:ok, user1} = Wallaby.start_session  
{:ok,  %Wallaby.Session{driver: Wallaby.Phantom..............}}

And:

Wallaby.visit(user1, "http://example.com")
** (UndefinedFunctionError) function Wallaby.visit/2 is undefined or private

Or just:

iex(79)> visit(user1, "http://example.com")        
** (CompileError) iex:79: undefined function visit/2

remember most if not all hex packages have excellent documentation - go to the wallaby docs https://hexdocs.pm/wallaby - and when you search for visit you’ll get https://hexdocs.pm/wallaby/Wallaby.Browser.html#visit/2

3 Likes

Wallebey.Browser.visit(user1, "http://example.com")

and

** (UndefinedFunctionError) function Wallebey.Browser.visit/2 is undefined (module Wallebey.Browser is not available)

You’ve got the library name wrong.

Try: Wallaby.Browser.visit(user1, "http://example.com")

1 Like
  1. does Wallaby support only Phantom? 2) And only in the invisible mode? 3) Thus that won’t allow me to see what’s going on on a page, what it looks like, etc?