Added more command from JSONWireProtol.
This commit is contained in:
@@ -859,6 +859,98 @@ feature -- Commands
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_enabled (a_session_id: STRING_32; 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_element_enabled (a_session_id,id))
|
||||
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 := new_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_selected (a_session_id: STRING_32; 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_element_selected (a_session_id,id))
|
||||
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 := new_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
element_value (a_session_id: STRING_32; id : STRING_32; name : 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_element_attribute_name (a_session_id,id,name))
|
||||
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 := new_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
element_equals (a_session_id: STRING_32; id : STRING_32; other : 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_element_equals (a_session_id,id,other))
|
||||
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 := new_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_displayed (a_session_id: STRING_32; 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_element_displayed (a_session_id,id))
|
||||
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 := new_response (l_body)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
execute_get (command_name: STRING_32): HTTP_CLIENT_RESPONSE
|
||||
|
||||
@@ -1072,7 +1072,6 @@ feature -- Commands
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
search_elements_id (a_session_id: STRING_32; an_id: STRING_32; strategy: STRING_32): detachable LIST [WEB_ELEMENT]
|
||||
-- POST /session/:sessionId/element/:id/elements
|
||||
-- Search for multiple elements on the page, starting from the identified element.
|
||||
@@ -1127,7 +1126,6 @@ feature -- Commands
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
element_click (a_session_id: STRING_32; an_id: STRING_32)
|
||||
@@ -1324,7 +1322,18 @@ feature -- Commands
|
||||
-- Potential Errors:
|
||||
-- NoSuchWindow - If the currently selected window has been closed.
|
||||
-- StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
||||
local
|
||||
resp: SE_RESPONSE
|
||||
do
|
||||
if commnad_executor.is_available then
|
||||
resp := commnad_executor.is_selected (a_session_id, an_id)
|
||||
check_response (resp)
|
||||
if not has_error then
|
||||
if attached {JSON_BOOLEAN} resp.value as l_value then
|
||||
Result := (l_value.item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_enabled (a_session_id: STRING_32; an_id: STRING_32): BOOLEAN
|
||||
@@ -1338,7 +1347,18 @@ feature -- Commands
|
||||
-- Potential Errors:
|
||||
-- NoSuchWindow - If the currently selected window has been closed.
|
||||
-- StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
||||
local
|
||||
resp: SE_RESPONSE
|
||||
do
|
||||
if commnad_executor.is_available then
|
||||
resp := commnad_executor.is_enabled (a_session_id, an_id)
|
||||
check_response (resp)
|
||||
if not has_error then
|
||||
if attached {JSON_BOOLEAN} resp.value as l_value then
|
||||
Result := (l_value.item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
element_value (a_session_id: STRING_32; an_id: STRING_32; a_name: STRING_32): detachable STRING_32
|
||||
@@ -1352,7 +1372,18 @@ feature -- Commands
|
||||
-- Potential Errors:
|
||||
-- NoSuchWindow - If the currently selected window has been closed.
|
||||
-- StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
||||
local
|
||||
resp: SE_RESPONSE
|
||||
do
|
||||
if commnad_executor.is_available then
|
||||
resp := commnad_executor.element_value (a_session_id, an_id, a_name)
|
||||
check_response (resp)
|
||||
if not has_error then
|
||||
if attached resp.value as l_value then
|
||||
Result := l_value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
elements_equals (a_session_id: STRING_32; an_id: STRING_32; an_other: STRING_32): BOOLEAN
|
||||
@@ -1367,10 +1398,21 @@ feature -- Commands
|
||||
-- Potential Errors:
|
||||
-- NoSuchWindow - If the currently selected window has been closed.
|
||||
-- StaleElementReference - If either the element refered to by :id or :other is no longer attached to the page's DOM.
|
||||
local
|
||||
resp: SE_RESPONSE
|
||||
do
|
||||
if commnad_executor.is_available then
|
||||
resp := commnad_executor.element_equals (a_session_id, an_id, an_other)
|
||||
check_response (resp)
|
||||
if not has_error then
|
||||
if attached {JSON_BOOLEAN} resp.value as l_value then
|
||||
Result := (l_value.item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
is_displayed (a_session_id: STRING_32; an_id: STRING_32)
|
||||
is_displayed (a_session_id: STRING_32; an_id: STRING_32): BOOLEAN
|
||||
-- GET /session/:sessionId/element/:id/displayed
|
||||
-- Determine if an element is currently displayed.
|
||||
-- URL Parameters:
|
||||
@@ -1381,7 +1423,18 @@ feature -- Commands
|
||||
-- Potential Errors:
|
||||
-- NoSuchWindow - If the currently selected window has been closed.
|
||||
-- StaleElementReference - If the element referenced by :id is no longer attached to the page's DOM.
|
||||
local
|
||||
resp: SE_RESPONSE
|
||||
do
|
||||
if commnad_executor.is_available then
|
||||
resp := commnad_executor.is_displayed (a_session_id, an_id)
|
||||
check_response (resp)
|
||||
if not has_error then
|
||||
if attached {JSON_BOOLEAN} resp.value as l_value then
|
||||
Result := (l_value.item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
element_location (a_session_id: STRING_32; an_id: STRING_32)
|
||||
|
||||
@@ -360,12 +360,56 @@ feature
|
||||
end
|
||||
|
||||
|
||||
cmd_session_element_selected_tmpl : STRING ="session/$sessionId/element/$id/selected"
|
||||
|
||||
cmd_session_element_selected (sessionId: STRING_32; id : STRING_32 ): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_element_selected_tmpl)
|
||||
Result.replace_substring_all ("$sessionId", sessionId)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
|
||||
cmd_session_element_enabled_tmpl : STRING ="session/$sessionId/element/$id/enabled"
|
||||
|
||||
cmd_session_element_enabled (sessionId: STRING_32; id : STRING_32 ): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_element_enabled_tmpl)
|
||||
Result.replace_substring_all ("$sessionId", sessionId)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
|
||||
cmd_session_element_attribute_name_tmpl : STRING ="session/$sessionId/element/$id/attribute/$name"
|
||||
|
||||
cmd_session_element_attribute_name (sessionId: STRING_32; id : STRING_32; name : STRING_32 ): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_element_attribute_name_tmpl)
|
||||
Result.replace_substring_all ("$sessionId", sessionId)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
Result.replace_substring_all ("$name", name)
|
||||
end
|
||||
|
||||
cmd_session_element_equals_tmpl : STRING ="session/$sessionId/element/$id/equals/$other"
|
||||
|
||||
cmd_session_element_equals (sessionId: STRING_32; id : STRING_32; other : STRING_32 ): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_element_equals_tmpl)
|
||||
Result.replace_substring_all ("$sessionId", sessionId)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
Result.replace_substring_all ("$other", other)
|
||||
end
|
||||
|
||||
cmd_session_element_displayed_tmpl : STRING ="session/$sessionId/element/$id/displayed"
|
||||
|
||||
cmd_session_element_displayed (sessionId: STRING_32; id : STRING_32): STRING_32
|
||||
do
|
||||
create Result.make_from_string (cmd_session_element_displayed_tmpl)
|
||||
Result.replace_substring_all ("$sessionId", sessionId)
|
||||
Result.replace_substring_all ("$id", id)
|
||||
end
|
||||
|
||||
|
||||
--GET /session/:sessionId/element/:id/selected Determine if an OPTION element, or an INPUT element of type checkbox or radiobutton is currently selected.
|
||||
--GET /session/:sessionId/element/:id/enabled Determine if an element is currently enabled.
|
||||
--GET /session/:sessionId/element/:id/attribute/:name Get the value of an element's attribute.
|
||||
--GET /session/:sessionId/element/:id/equals/:other Test if two element IDs refer to the same DOM element.
|
||||
--GET /session/:sessionId/element/:id/displayed Determine if an element is currently displayed.
|
||||
--GET /session/:sessionId/element/:id/location Determine an element's location on the page.
|
||||
--GET /session/:sessionId/element/:id/location_in_view Determine an element's location on the screen once it has been scrolled into view.
|
||||
|
||||
@@ -19,15 +19,21 @@ feature -- Initialization
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
--width: number, height: number} The size of the window.
|
||||
--{ width: number, height: number} The size of the window.
|
||||
width : NATURAL_32
|
||||
height : NATURAL_32
|
||||
-- The width and height of the element, in pixels.
|
||||
|
||||
x,y : INTEGER_32
|
||||
-- The X and Y coordinates for the element.
|
||||
|
||||
feature -- Change Element
|
||||
set_width (a_width : NATURAL_32)
|
||||
--Set width to `a_width'
|
||||
do
|
||||
width := a_width
|
||||
ensure
|
||||
width_set : width = a_width
|
||||
end
|
||||
|
||||
set_height (a_height : NATURAL_32)
|
||||
|
||||
Reference in New Issue
Block a user