Skip to content

Instantly share code, notes, and snippets.

@dgoldie
Created October 31, 2014 19:02
Show Gist options
  • Save dgoldie/13564e431d303fb63c84 to your computer and use it in GitHub Desktop.
Save dgoldie/13564e431d303fb63c84 to your computer and use it in GitHub Desktop.
tuco adventures
Erlang/OTP 17 [erts-6.0] [source] [64-bit] [smp:8:8] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Interactive Elixir (1.0.1-dev) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> use TucoTuco.DSL
:ok
iex(2)> TucoTuco.start_session :browser_test, :test_login, :firefox
** (exit) exited in: :gen_server.call(:tuco_tuco, {:start_session, %WebDriver.Config{browser: :firefox, name: :browser_test, root_url: ""}, :test_login})
** (EXIT) exited in: :gen_server.call(:browser_test, {:start_session, :test_login})
** (EXIT) no process
12:00:21.048 [error] GenServer :tuco_tuco terminating
Last message: {:start_session, %WebDriver.Config{browser: :firefox, name: :browser_test, root_url: ""}, :test_login}
State: %TucoTuco.SessionPool.SessionPoolState{app_root: nil, current_session: nil, max_retry_time: 2000, retry_delay: 50, use_retry: false}
** (exit) exited in: :gen_server.call(:browser_test, {:start_session, :test_login})
** (EXIT) no process
(stdlib) gen_server.erl:182: :gen_server.call/2
iex(2)>
iex(14)> visit "http://games.espn.go.com/ffl/signin"
{:ok,
%WebDriver.Protocol.Response{request: %WebDriver.Protocol.Request{body: "{\"url\":\"http://games.espn.go.com/ffl/signin\"}",
headers: ["Content-Type": "application/json;charset=UTF-8",
"Content-Length": 45], method: :POST,
url: "http://localhost:56039/wd/hub/session/7c3ccee0-612d-11e4-ada1-77d979f47865/url"},
session_id: "7c3ccee0-612d-11e4-ada1-77d979f47865", status: 0, value: %{}}}
iex(15)> fill_in "username", "cookiemonsters20"
{:ok,
%WebDriver.Protocol.Response{request: %WebDriver.Protocol.Request{body: "{\"value\":[\"c\",\"o\",\"o\",\"k\",\"i\",\"e\",\"m\",\"o\",\"n\",\"s\",\"t\",\"e\",\"r\",\"s\",\"2\",\"0\"]}",
headers: ["Content-Type": "application/json;charset=UTF-8",
"Content-Length": 75], method: :POST,
url: "http://localhost:56039/wd/hub/session/7c3ccee0-612d-11e4-ada1-77d979f47865/element/:wdc:1414781493353/value"},
session_id: "7c3ccee0-612d-11e4-ada1-77d979f47865", status: 0, value: nil}}
iex(16)> fill_in "password", "password1"
{:ok,
%WebDriver.Protocol.Response{request: %WebDriver.Protocol.Request{body: "{\"value\":[\"p\",\"a\",\"s\",\"s\",\"w\",\"o\",\"r\",\"d\",\"1\"]}",
headers: ["Content-Type": "application/json;charset=UTF-8",
"Content-Length": 47], method: :POST,
url: "http://localhost:56039/wd/hub/session/7c3ccee0-612d-11e4-ada1-77d979f47865/element/:wdc:1414781493354/value"},
session_id: "7c3ccee0-612d-11e4-ada1-77d979f47865", status: 0, value: nil}}
iex(17)> click_button "Sign In"
{:ok,
%WebDriver.Protocol.Response{request: %WebDriver.Protocol.Request{body: "{}",
headers: ["Content-Type": "application/json;charset=UTF-8",
"Content-Length": 2], method: :POST,
url: "http://localhost:56039/wd/hub/session/7c3ccee0-612d-11e4-ada1-77d979f47865/element/:wdc:1414781493355/click"},
session_id: "7c3ccee0-612d-11e4-ada1-77d979f47865", status: 0, value: %{}}}
iex(18)> Page.has_text? "Kerber"
false
iex(19)> Page.has_text? "Sign In or Register"
true
iex(20)> Page.has_text? "Jonathan"
false
iex(21)> Finder.find(:xpath, "//html/body") |> Element.attribute :text
""
iex(22)>
nil
iex(23)> save_screenshot "./userpage.png"
:ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment