Updated RestAPI commands
This commit is contained in:
@@ -7,36 +7,45 @@ note
|
||||
|
||||
class
|
||||
COMMAND_EXECUTOR
|
||||
|
||||
inherit
|
||||
|
||||
JSON_HELPER
|
||||
|
||||
SE_JSON_WIRE_PROTOCOL_COMMANDS
|
||||
|
||||
-- TODO
|
||||
-- clean and improve the code
|
||||
-- handle response from the server in a smart way
|
||||
create
|
||||
make
|
||||
|
||||
feature -- Initialization
|
||||
make (a_host : STRING_32)
|
||||
|
||||
make (a_host: STRING_32)
|
||||
local
|
||||
h: LIBCURL_HTTP_CLIENT
|
||||
do
|
||||
host := a_host
|
||||
create h.make
|
||||
http_session := h.new_session (a_host)
|
||||
-- http_session.set_is_debug (True)
|
||||
-- http_session.set_proxy ("127.0.0.1", 8888)
|
||||
end
|
||||
|
||||
feature -- Status Report
|
||||
is_available : BOOLEAN
|
||||
-- Is the Seleniun server up and running?
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
|
||||
is_available: BOOLEAN
|
||||
-- Is the Seleniun server up and running?
|
||||
do
|
||||
-- resp := execute_get (cmd_ping)
|
||||
-- if resp.status = 200 then
|
||||
-- Result := True
|
||||
-- end
|
||||
Result := true
|
||||
Result := http_session.is_available
|
||||
end
|
||||
|
||||
feature -- Commands
|
||||
|
||||
status : SE_RESPONSE
|
||||
status: SE_RESPONSE
|
||||
require
|
||||
selinum_server_available : is_available
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
@@ -47,57 +56,358 @@ feature -- Commands
|
||||
end
|
||||
end
|
||||
|
||||
new_session (capabilities : STRING_32) : SE_RESPONSE
|
||||
new_session (capabilities: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available : is_available
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_post (cmd_new_session, capabilities)
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response(l_body)
|
||||
if attached resp.header ("Location") as l_location then
|
||||
resp := http_new_session (l_location).get ("", context_executor)
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
sessions : SE_RESPONSE
|
||||
sessions: SE_RESPONSE
|
||||
require
|
||||
selinum_server_available : is_available
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_get (cmd_sessions)
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response(l_body)
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
retrieve_session (session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_get (cmd_session_by_id (session_id))
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
delete_session (session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_delete (cmd_session_by_id (cmd_session_by_id (session_id)))
|
||||
if resp.status = 204 then
|
||||
Result.set_status (0)
|
||||
Result.set_session_id (session_id)
|
||||
else
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set_session_timeouts (a_session_id: STRING_32; a_data_timeout: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_post (cmd_session_timeouts (a_session_id), a_data_timeout)
|
||||
if resp.status = 204 then
|
||||
Result.set_status (0)
|
||||
Result.set_session_id (a_session_id)
|
||||
else
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
set_session_timeouts_async_script (a_session_id: STRING_32; a_data_timeout: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_post (cmd_session_timeouts_async_script (a_session_id), a_data_timeout)
|
||||
if resp.status = 204 then
|
||||
Result.set_status (0)
|
||||
Result.set_session_id (a_session_id)
|
||||
else
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
set_session_timeouts_implicit_wait (a_session_id: STRING_32; a_data_timeout: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_post (cmd_session_timeouts_implicit_wait (a_session_id), a_data_timeout)
|
||||
if resp.status = 204 then
|
||||
Result.set_status (0)
|
||||
Result.set_session_id (a_session_id)
|
||||
else
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
retrieve_window_handle (session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_get (cmd_session_window_handle (session_id))
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
retrieve_window_handles (session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_get (cmd_session_window_handles (session_id))
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
retrieve_url (session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_get (cmd_session_url (session_id))
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
navigate_to_url (a_session_id: STRING_32; a_url: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_post (cmd_session_url (a_session_id), a_url)
|
||||
if resp.status = 204 then
|
||||
Result.set_status (0)
|
||||
Result.set_session_id (a_session_id)
|
||||
else
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
forward (a_session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_post (cmd_session_forward (a_session_id), Void)
|
||||
if resp.status = 204 then
|
||||
Result.set_status (0)
|
||||
Result.set_session_id (a_session_id)
|
||||
else
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
back (a_session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_post (cmd_session_back (a_session_id), Void)
|
||||
if resp.status = 204 then
|
||||
Result.set_status (0)
|
||||
Result.set_session_id (a_session_id)
|
||||
else
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
refresh (a_session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_post (cmd_session_refresh (a_session_id), Void)
|
||||
if resp.status = 204 then
|
||||
Result.set_status (0)
|
||||
Result.set_session_id (a_session_id)
|
||||
else
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
execute
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
-- TODO
|
||||
end
|
||||
|
||||
execute_async
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
-- TODO
|
||||
end
|
||||
|
||||
screenshot (session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_get (cmd_session_screenshot (session_id))
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
ime_available_engines (session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_get (cmd_session_ime_available (session_id))
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
ime_active_engine (session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_get (cmd_session_ime_active_engine (session_id))
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
ime_activated (session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_get (cmd_session_ime_activated (session_id))
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
ime_deactivate (a_session_id: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_post (cmd_session_ime_deactivate (a_session_id), Void)
|
||||
if resp.status = 204 then
|
||||
Result.set_status (0)
|
||||
Result.set_session_id (a_session_id)
|
||||
else
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ime_activate (a_session_id: STRING_32; an_engine: STRING_32): SE_RESPONSE
|
||||
require
|
||||
selinum_server_available: is_available
|
||||
local
|
||||
resp: HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
resp := execute_post (cmd_session_ime_activate (a_session_id), an_engine)
|
||||
if resp.status = 204 then
|
||||
Result.set_status (0)
|
||||
Result.set_session_id (a_session_id)
|
||||
else
|
||||
if attached resp.body as l_body then
|
||||
Result := build_response (l_body)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
execute_get (command_name:STRING_32) : HTTP_CLIENT_RESPONSE
|
||||
local
|
||||
h: LIBCURL_HTTP_CLIENT
|
||||
http_session : HTTP_CLIENT_SESSION
|
||||
|
||||
execute_get (command_name: STRING_32): HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create h.make
|
||||
http_session := h.new_session (host)
|
||||
Result := http_session.get (command_name, context_executor)
|
||||
end
|
||||
|
||||
execute_post (command_name:STRING_32; data: STRING_32) : HTTP_CLIENT_RESPONSE
|
||||
local
|
||||
h: LIBCURL_HTTP_CLIENT
|
||||
http_session : HTTP_CLIENT_SESSION
|
||||
execute_post (command_name: STRING_32; data: detachable READABLE_STRING_8): HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
create h.make
|
||||
http_session := h.new_session (host)
|
||||
Result := http_session.post (command_name, context_executor, data)
|
||||
|
||||
end
|
||||
|
||||
execute_delete (command_name: STRING_32): HTTP_CLIENT_RESPONSE
|
||||
do
|
||||
Result := http_session.delete (command_name, context_executor)
|
||||
end
|
||||
|
||||
build_response (a_message : STRING_32) : SE_RESPONSE
|
||||
build_response (a_message: STRING_32): SE_RESPONSE
|
||||
do
|
||||
create Result.make_empty
|
||||
initialize_converters (json)
|
||||
@@ -107,14 +417,26 @@ feature {NONE} -- Implementation
|
||||
Result.set_json_response (a_message)
|
||||
end
|
||||
|
||||
|
||||
context_executor : HTTP_CLIENT_REQUEST_CONTEXT
|
||||
-- request context for each request
|
||||
once
|
||||
context_executor: HTTP_CLIENT_REQUEST_CONTEXT
|
||||
-- request context for each request
|
||||
do
|
||||
create Result.make
|
||||
Result.headers.put ("application/json;charset=UTF-8", "Content-Type")
|
||||
Result.headers.put ("application/json;charset=UTF-8", "Accept")
|
||||
end
|
||||
|
||||
host : STRING_32
|
||||
host: STRING_32
|
||||
|
||||
http_session: HTTP_CLIENT_SESSION
|
||||
|
||||
http_new_session (url: STRING_32): HTTP_CLIENT_SESSION
|
||||
local
|
||||
h: LIBCURL_HTTP_CLIENT
|
||||
do
|
||||
create h.make
|
||||
Result := h.new_session (url)
|
||||
-- Result.set_is_debug (True)
|
||||
-- Result.set_proxy ("127.0.0.1", 8888)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -29,8 +29,8 @@ feature -- Conversion
|
||||
from_json (j: like to_json): detachable like object
|
||||
do
|
||||
create Result
|
||||
if attached {INTEGER_8} json_to_object (j.item (status_key), Void) as l_ucs then
|
||||
Result.set_status (l_ucs.out)
|
||||
if attached {INTEGER_32} json_to_object (j.item (status_key), Void) as l_ucs then
|
||||
Result.set_status (l_ucs)
|
||||
end
|
||||
if attached {STRING_32} json_to_object (j.item (session_id_key), Void) as l_ucs then
|
||||
Result.set_session_id (l_ucs)
|
||||
|
||||
@@ -27,7 +27,7 @@ feature -- Access
|
||||
do
|
||||
initialize_converters (json)
|
||||
create parser.make_parser (str)
|
||||
if attached parser.parse_object as st and parser.is_parsed then
|
||||
if attached parser.parse as st and parser.is_parsed then
|
||||
Result := st
|
||||
end
|
||||
end
|
||||
@@ -68,5 +68,6 @@ feature -- Access
|
||||
j.add_converter (create {SE_STATUS_VALUE_JSON_CONVERTER}.make)
|
||||
j.add_converter (create {SE_CAPABILITIES_JSON_CONVERTER}.make)
|
||||
j.add_converter (create {SE_RESPONSE_JSON_CONVERTER}.make)
|
||||
j.add_converter (create {SE_TIMEOUT_TYPE_JSON_CONVERTER}.make)
|
||||
end
|
||||
end
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,25 +19,148 @@ feature
|
||||
--POST /session Create a new session.
|
||||
cmd_sessions : STRING = "sessions"
|
||||
--GET /sessions Returns a list of the currently active sessions.
|
||||
--GET /session/:sessionId Retrieve the capabilities of the specified session.
|
||||
--DELETE /session/:sessionId Delete the session.
|
||||
--POST /session/:sessionId/timeouts Configure the amount of time that a particular type of operation can execute for before they are aborted and a |Timeout| error is returned to the client.
|
||||
--POST /session/:sessionId/timeouts/async_script Set the amount of time, in milliseconds, that asynchronous scripts executed by /session/:sessionId/execute_async are permitted to run before they are aborted and a |Timeout| error is returned to the client.
|
||||
--POST /session/:sessionId/timeouts/implicit_wait Set the amount of time the driver should wait when searching for elements.
|
||||
--GET /session/:sessionId/window_handle Retrieve the current window handle.
|
||||
--GET /session/:sessionId/window_handles Retrieve the list of all window handles available to the session.
|
||||
--GET /session/:sessionId/url Retrieve the URL of the current page.
|
||||
--POST /session/:sessionId/url Navigate to a new URL.
|
||||
--POST /session/:sessionId/forward Navigate forwards in the browser history, if possible.
|
||||
--POST /session/:sessionId/back Navigate backwards in the browser history, if possible.
|
||||
--POST /session/:sessionId/refresh Refresh the current page.
|
||||
|
||||
cmd_session_by_id_tmpl : STRING ="session/$id"
|
||||
|
||||
cmd_session_by_id (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_by_id_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
|
||||
cmd_session_timeouts_tmpl : STRING ="session/$id/timeouts"
|
||||
|
||||
cmd_session_timeouts (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_timeouts_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
cmd_session_timeouts_async_script_tmpl : STRING ="session/$id/timeouts/async_script"
|
||||
|
||||
cmd_session_timeouts_async_script (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_timeouts_async_script_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
cmd_session_timeouts_implicit_wait_tmpl : STRING ="/session/$id/timeouts/implicit_wait"
|
||||
|
||||
cmd_session_timeouts_implicit_wait (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_timeouts_implicit_wait_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
|
||||
cmd_session_window_handle_tmpl : STRING ="/session/$id/window_handle"
|
||||
|
||||
cmd_session_window_handle (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_window_handle_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
cmd_session_window_handles_tmpl : STRING ="/session/$id/window_handles"
|
||||
|
||||
cmd_session_window_handles (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_window_handles_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
cmd_session_url_tmpl : STRING ="/session/$id/url"
|
||||
|
||||
cmd_session_url (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_url_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
|
||||
|
||||
cmd_session_forward_tmpl : STRING ="/session/$id/forward"
|
||||
|
||||
cmd_session_forward (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_forward_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
cmd_session_back_tmpl : STRING ="/session/$id/back"
|
||||
|
||||
cmd_session_back (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_back_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
|
||||
cmd_session_refresh_tmpl : STRING ="/session/$id/refresh"
|
||||
|
||||
cmd_session_refresh (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_refresh_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
|
||||
--POST /session/:sessionId/execute Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
|
||||
--POST /session/:sessionId/execute_async Inject a snippet of JavaScript into the page for execution in the context of the currently selected frame.
|
||||
--GET /session/:sessionId/screenshot Take a screenshot of the current page.
|
||||
--GET /session/:sessionId/ime/available_engines List all available engines on the machine.
|
||||
--GET /session/:sessionId/ime/active_engine Get the name of the active IME engine.
|
||||
--GET /session/:sessionId/ime/activated Indicates whether IME input is active at the moment (not if it's available.
|
||||
--POST /session/:sessionId/ime/deactivate De-activates the currently-active IME engine.
|
||||
|
||||
|
||||
cmd_session_screenshot_tmpl : STRING ="/session/$id/screenshot"
|
||||
|
||||
cmd_session_screenshot (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_screenshot_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
|
||||
cmd_session_ime_available_engines_tmpl : STRING ="/session/$id/ime/available_engines"
|
||||
|
||||
cmd_session_ime_available (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_ime_available_engines_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
cmd_session_ime_active_engine_tmpl : STRING ="/session/$id/ime/active_engine"
|
||||
|
||||
cmd_session_ime_active_engine (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_ime_active_engine_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
cmd_session_ime_activated_tmpl : STRING ="/session/$id/ime/activated"
|
||||
|
||||
cmd_session_ime_activated (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_ime_activated_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
cmd_session_ime_deactivate_tmpl : STRING ="/session/$id/ime/deactivate"
|
||||
|
||||
cmd_session_ime_deactivate (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_ime_deactivate_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
cmd_session_ime_activate_tmpl : STRING ="/session/$id/ime/activate"
|
||||
|
||||
cmd_session_ime_activate (id: STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_ime_activate_tmpl)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--POST /session/:sessionId/ime/activate Make an engines that is available (appears on the listreturned by getAvailableEngines) active.
|
||||
--POST /session/:sessionId/frame Change focus to another frame on the page.
|
||||
--POST /session/:sessionId/window Change focus to another window.
|
||||
|
||||
@@ -14,7 +14,7 @@ inherit
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
status: detachable STRING_32
|
||||
status: INTEGER_32
|
||||
session_id: detachable STRING_32
|
||||
state: detachable STRING_32
|
||||
class_name: detachable STRING_32
|
||||
@@ -22,7 +22,7 @@ feature -- Access
|
||||
hash_code: detachable STRING_32
|
||||
|
||||
feature -- Change Element
|
||||
set_status (a_status : STRING_32)
|
||||
set_status (a_status : INTEGER_32)
|
||||
do
|
||||
status := a_status
|
||||
end
|
||||
@@ -55,12 +55,11 @@ feature -- Change Element
|
||||
out : STRING
|
||||
do
|
||||
create Result.make_from_string ("Response : ")
|
||||
if attached status as l_satus then
|
||||
Result.append ("[Status:")
|
||||
Result.append (l_satus.out)
|
||||
Result.append ("]")
|
||||
Result.append (" ")
|
||||
end
|
||||
Result.append ("[Status:")
|
||||
Result.append (status.out)
|
||||
Result.append ("]")
|
||||
Result.append (" ")
|
||||
|
||||
if attached session_id as l_session_id then
|
||||
Result.append ("[SessionId:")
|
||||
Result.append (l_session_id.out)
|
||||
|
||||
@@ -21,4 +21,13 @@ feature -- Access
|
||||
code : INTEGER_32
|
||||
summary : STRING_32
|
||||
detail : STRING_32
|
||||
|
||||
feature -- Report
|
||||
full_message : STRING_32
|
||||
-- Full error description
|
||||
do
|
||||
create Result.make_empty
|
||||
Result.append ("code : " + code.out + " - summary:" + summary + " - detail:" + detail)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
45
library/test/selenium/src/se_timeout_type.e
Normal file
45
library/test/selenium/src/se_timeout_type.e
Normal file
@@ -0,0 +1,45 @@
|
||||
note
|
||||
description: "Summary description for {SE_TIMEOUT_TYPE}."
|
||||
author: ""
|
||||
date: "$Date$"
|
||||
revision: "$Revision$"
|
||||
|
||||
class
|
||||
SE_TIMEOUT_TYPE
|
||||
|
||||
create
|
||||
make,
|
||||
make_empty
|
||||
|
||||
feature -- Initialization
|
||||
make (a_type : STRING_32; a_ms : INTEGER_32)
|
||||
do
|
||||
set_type (a_type)
|
||||
set_ms (a_ms)
|
||||
end
|
||||
|
||||
make_empty
|
||||
do
|
||||
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
type : detachable STRING_32
|
||||
-- The type of operation to set the timeout for.
|
||||
-- Valid values are: "script" for script timeouts,
|
||||
-- "implicit" for modifying the implicit wait timeout and
|
||||
-- "page load" for setting a page load timeout.
|
||||
ms : INTEGER_32
|
||||
-- The amount of time, in milliseconds, that time-limited commands are permitted to run.
|
||||
|
||||
feature -- Change Element
|
||||
set_type (a_type : STRING_32)
|
||||
do
|
||||
type := a_type
|
||||
end
|
||||
|
||||
set_ms (a_ms : INTEGER_32)
|
||||
do
|
||||
ms := a_ms
|
||||
end
|
||||
end
|
||||
@@ -6,5 +6,21 @@ note
|
||||
|
||||
class
|
||||
WEB_ELEMENT
|
||||
create
|
||||
make
|
||||
feature
|
||||
make
|
||||
do
|
||||
|
||||
end
|
||||
feature -- Access
|
||||
element : detachable STRING_32
|
||||
--The opaque ID assigned to the element by the server.
|
||||
--This ID should be used in all subsequent commands issued against the element.
|
||||
|
||||
feature -- Change Element
|
||||
set_element (an_element : STRING)
|
||||
do
|
||||
element := an_element
|
||||
end
|
||||
end
|
||||
|
||||
@@ -24,13 +24,16 @@ feature {NONE} -- Initialization
|
||||
if attached web_driver.status as l_status then
|
||||
print (l_status)
|
||||
|
||||
-- retrieve sessions
|
||||
if attached web_driver.sessions as l_session then
|
||||
across l_session as item loop
|
||||
print (item)
|
||||
end
|
||||
|
||||
|
||||
-- create a new session
|
||||
create capabilities.make
|
||||
capabilities.set_browser_name ("chrome")
|
||||
if attached web_driver.create_session_with_desired_capabilities (capabilities) as l_session then
|
||||
print ("%NSessionId:" + l_session.session_id)
|
||||
end
|
||||
|
||||
|
||||
-- create a new session
|
||||
create capabilities.make
|
||||
capabilities.set_browser_name ("chrome")
|
||||
@@ -41,8 +44,8 @@ feature {NONE} -- Initialization
|
||||
|
||||
-- retrieve sessions
|
||||
if attached web_driver.sessions as l_session then
|
||||
across l_session as item loop
|
||||
print (item)
|
||||
across l_session as l_item loop
|
||||
print (l_item)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
28
library/test/selenium/test/exception_trace.log
Normal file
28
library/test/selenium/test/exception_trace.log
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
test: system execution failed.
|
||||
Following is the set of recorded exceptions:
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Class / Object Routine Nature of exception Effect
|
||||
-------------------------------------------------------------------------------
|
||||
JSON_PARSER make_parser @1 json_not_empty:
|
||||
<00000000029AAD48> Precondition violated. Fail
|
||||
-------------------------------------------------------------------------------
|
||||
SE_JSON_WIRE_PROTOCOL
|
||||
string_to_json @2
|
||||
<00000000029705E8> (From JSON_HELPER) Routine failure. Fail
|
||||
-------------------------------------------------------------------------------
|
||||
SE_JSON_WIRE_PROTOCOL
|
||||
build_session @1
|
||||
<00000000029705E8> Routine failure. Fail
|
||||
-------------------------------------------------------------------------------
|
||||
SE_JSON_WIRE_PROTOCOL
|
||||
create_session_with_desired_capabilities @5
|
||||
<00000000029705E8> Routine failure. Fail
|
||||
-------------------------------------------------------------------------------
|
||||
APPLICATION make @6
|
||||
<00000000029705A8> Routine failure. Fail
|
||||
-------------------------------------------------------------------------------
|
||||
APPLICATION root's creation
|
||||
<00000000029705A8> Routine failure. Exit
|
||||
-------------------------------------------------------------------------------
|
||||
Reference in New Issue
Block a user