我试图在单击按钮后等待一个元素出现在页面上,但无法弄清楚如何等待该元素......我知道有:timer.sleep(100),但每当我使用这个我得到以下错误。
20:17:56.605 [error] GenServer Hound.SessionServer terminating
** (RuntimeError) could not create a new session: timeout, check webdriver is running
(hound 1.1.0) lib/hound/session_server.ex:101: Hound.SessionServer.create_session/2
(hound 1.1.0) lib/hound/session_server.ex:78: Hound.SessionServer.handle_call/3
(stdlib 3.17) gen_server.erl:721: :gen_server.try_handle_call/4
(stdlib 3.17) gen_server.erl:750: :gen_server.handle_msg/6
(stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message (from #PID<0.257.0>): {:change_session, #PID<0.257.0>, :default, []}
State: %{}
Client #PID<0.257.0> is alive
(stdlib 3.17) gen.erl:233: :gen.do_call/4
(elixir 1.13.1) lib/gen_server.ex:1027: GenServer.call/3
test/homework_test.exs:7: HomeworkTest.__ex_unit_setup_0/1
test/homework_test.exs:1: HomeworkTest.__ex_unit__/2
(ex_unit 1.13.1) lib/ex_unit/runner.ex:493: ExUnit.Runner.exec_test_setup/2
(ex_unit 1.13.1) lib/ex_unit/runner.ex:452: anonymous fn/2 in ExUnit.Runner.spawn_test_monitor/4
(stdlib 3.17) timer.erl:166: :timer.tc/1
(ex_unit 1.13.1) lib/ex_unit/runner.ex:451: anonymous fn/4 in ExUnit.Runner.spawn_test_monitor/4
1) test Dynamic Controls (HomeworkTest)
test/homework_test.exs:10
** (exit) exited in: GenServer.call(Hound.SessionServer, {:change_session, #PID<0.257.0>, :default, []}, 60000)
** (EXIT) an exception was raised:
** (RuntimeError) could not create a new session: timeout, check webdriver is running
(hound 1.1.0) lib/hound/session_server.ex:101: Hound.SessionServer.create_session/2
(hound 1.1.0) lib/hound/session_server.ex:78: Hound.SessionServer.handle_call/3
(stdlib 3.17) gen_server.erl:721: :gen_server.try_handle_call/4
(stdlib 3.17) gen_server.erl:750: :gen_server.handle_msg/6
(stdlib 3.17) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
stacktrace:
(elixir 1.13.1) lib/gen_server.ex:1030: GenServer.call/3
test/homework_test.exs:7: HomeworkTest.__ex_unit_setup_0/1
test/homework_test.exs:1: HomeworkTest.__ex_unit__/2
Finished in 5.1 seconds (0.00s async, 5.1s sync)
1 test, 1 failure'''