Added new selenium locator examples.
Fixed find_elements in WEB_DRIVER.
This commit is contained in:
@@ -30,4 +30,28 @@
|
|||||||
<root class="FIND_ELEMENT_CLASS" feature="default_create"/>
|
<root class="FIND_ELEMENT_CLASS" feature="default_create"/>
|
||||||
<cluster name="src" location=".\" recursive="true"/>
|
<cluster name="src" location=".\" recursive="true"/>
|
||||||
</target>
|
</target>
|
||||||
|
<target name="findElementChild" extends="selenium_example">
|
||||||
|
<root class="FIND_ELEMENT_CHILD" feature="default_create"/>
|
||||||
|
<cluster name="src" location=".\" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
<target name="findElementsLinks" extends="selenium_example">
|
||||||
|
<root class="FIND_ELEMENTS_LINKS" feature="default_create"/>
|
||||||
|
<cluster name="src" location=".\" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
<target name="findElementsLinksByText" extends="selenium_example">
|
||||||
|
<root class="FIND_ELEMENTS_LINKS_BY_TEXT" feature="default_create"/>
|
||||||
|
<cluster name="src" location=".\" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
<target name="findElementsLinksByPartialText" extends="selenium_example">
|
||||||
|
<root class="FIND_ELEMENTS_LINKS_BY_PARTIAL_TEXT" feature="default_create"/>
|
||||||
|
<cluster name="src" location=".\" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
<target name="findElementCssSelector" extends="selenium_example">
|
||||||
|
<root class="FIND_ELEMENT_CSS_SELECTOR" feature="default_create"/>
|
||||||
|
<cluster name="src" location=".\" recursive="true"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</system>
|
</system>
|
||||||
|
|||||||
61
library/test/selenium/examples/find_element_child.e
Normal file
61
library/test/selenium/examples/find_element_child.e
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
note
|
||||||
|
description: "The WEB_ELEMENT class also supports find methods that find child elements."
|
||||||
|
|
||||||
|
class
|
||||||
|
FIND_ELEMENT_CHILD
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
ANY
|
||||||
|
redefine
|
||||||
|
default_create
|
||||||
|
end
|
||||||
|
|
||||||
|
create
|
||||||
|
default_create
|
||||||
|
|
||||||
|
feature
|
||||||
|
|
||||||
|
default_create
|
||||||
|
do
|
||||||
|
search
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Search by id
|
||||||
|
|
||||||
|
search
|
||||||
|
local
|
||||||
|
web_driver: WEB_DRIVER
|
||||||
|
wait: WEB_DRIVER_WAIT
|
||||||
|
do
|
||||||
|
--Create a new instance of a Web driver
|
||||||
|
create web_driver.make
|
||||||
|
|
||||||
|
-- Start session with chrome
|
||||||
|
web_driver.start_session_chrome
|
||||||
|
|
||||||
|
-- Go to EiffelRoom login page
|
||||||
|
web_driver.to_url ("http://www.eiffelroom.com/")
|
||||||
|
|
||||||
|
-- Find the element div with id page,and then we can find a child element div page-inner
|
||||||
|
--<div id="page">
|
||||||
|
-- <div id="page-inner">
|
||||||
|
-- <a id="navigation-top" name="top"></a>
|
||||||
|
-- <div id="skip-to-nav">
|
||||||
|
-- <div id="header">
|
||||||
|
-- <div id="main">
|
||||||
|
-- <div id="footer">
|
||||||
|
-- </div>
|
||||||
|
--</div>
|
||||||
|
if attached {WEB_ELEMENT} web_driver.find_element ((create {SE_BY}).id ("page")) as l_div_page then
|
||||||
|
print ("%N Page element id" + l_div_page.element)
|
||||||
|
if attached {WEB_ELEMENT}l_div_page.find_element ((create {SE_BY}).id ("page-inner")) as l_div_page_inner then
|
||||||
|
print ("%N Inner Page element id" + l_div_page_inner.element)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- close the window
|
||||||
|
web_driver.window_close
|
||||||
|
print ("%N")
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
66
library/test/selenium/examples/find_element_css_selector.e
Normal file
66
library/test/selenium/examples/find_element_css_selector.e
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
]"
|
||||||
|
|
||||||
|
class
|
||||||
|
FIND_ELEMENT_CSS_SELECTOR
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
ANY
|
||||||
|
redefine
|
||||||
|
default_create
|
||||||
|
end
|
||||||
|
|
||||||
|
create
|
||||||
|
default_create
|
||||||
|
|
||||||
|
feature
|
||||||
|
|
||||||
|
default_create
|
||||||
|
do
|
||||||
|
search
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Search by id
|
||||||
|
|
||||||
|
search
|
||||||
|
local
|
||||||
|
web_driver: WEB_DRIVER
|
||||||
|
do
|
||||||
|
--Create a new instance of a Web driver
|
||||||
|
create web_driver.make
|
||||||
|
|
||||||
|
-- Start session with chrome
|
||||||
|
web_driver.start_session_chrome
|
||||||
|
|
||||||
|
-- Go to EiffelRoom home page
|
||||||
|
web_driver.to_url ("http://www.eiffelroom.com/")
|
||||||
|
|
||||||
|
-- Absolute Path
|
||||||
|
-- <div id="header">
|
||||||
|
-- html.js body.front div#page div#page-inner div#header
|
||||||
|
|
||||||
|
if attached {WEB_ELEMENT} web_driver.find_element ((create {SE_BY}).css_selector ("html.js body.front div#page div#page-inner div#header")) as selector then
|
||||||
|
print ("%NElement:" + selector.element)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Relative Path
|
||||||
|
--
|
||||||
|
if attached {WEB_ELEMENT} web_driver.find_element ((create {SE_BY}).css_selector ("div#header")) as selector then
|
||||||
|
print ("%NElement:" + selector.element)
|
||||||
|
end
|
||||||
|
print ("%Nend process ...")
|
||||||
|
io.read_line
|
||||||
|
-- close the window
|
||||||
|
web_driver.window_close
|
||||||
|
end
|
||||||
|
|
||||||
|
expected_title (driver: WEB_DRIVER; title: STRING_32): BOOLEAN
|
||||||
|
do
|
||||||
|
if attached {STRING_32} driver.get_page_tile as l_title and then l_title.has_substring (title) then
|
||||||
|
Result := True
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
65
library/test/selenium/examples/find_elements_links.e
Normal file
65
library/test/selenium/examples/find_elements_links.e
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
|
||||||
|
]"
|
||||||
|
|
||||||
|
class
|
||||||
|
FIND_ELEMENTS_LINKS
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
ANY
|
||||||
|
redefine
|
||||||
|
default_create
|
||||||
|
end
|
||||||
|
|
||||||
|
create
|
||||||
|
default_create
|
||||||
|
|
||||||
|
feature
|
||||||
|
|
||||||
|
default_create
|
||||||
|
do
|
||||||
|
search
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Search by id
|
||||||
|
|
||||||
|
search
|
||||||
|
local
|
||||||
|
web_driver: WEB_DRIVER
|
||||||
|
wait: WEB_DRIVER_WAIT
|
||||||
|
do
|
||||||
|
--Create a new instance of a Web driver
|
||||||
|
create web_driver.make
|
||||||
|
|
||||||
|
-- Start session with chrome
|
||||||
|
web_driver.start_session_chrome
|
||||||
|
|
||||||
|
-- Go to EiffelRoom home page
|
||||||
|
web_driver.to_url ("http://www.eiffelroom.com/")
|
||||||
|
|
||||||
|
create wait.make (web_driver,10)
|
||||||
|
wait.until_when (agent expected_title (web_driver, "Eiffel Room"))
|
||||||
|
|
||||||
|
|
||||||
|
-- Find links
|
||||||
|
if attached {ARRAYED_LIST[WEB_ELEMENT]}web_driver.find_elements ((create {SE_BY}).tag_name("a")) as l_links then
|
||||||
|
from
|
||||||
|
l_links.start
|
||||||
|
until
|
||||||
|
l_links.after
|
||||||
|
loop
|
||||||
|
if attached l_links.item.get_attribute ("href") as l_ref then
|
||||||
|
print ("%Nhref:" + l_ref)
|
||||||
|
end
|
||||||
|
l_links.forth
|
||||||
|
end
|
||||||
|
end
|
||||||
|
print ("%Nend process ..." )
|
||||||
|
io.read_line
|
||||||
|
-- close the window
|
||||||
|
web_driver.window_close
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
|
||||||
|
]"
|
||||||
|
|
||||||
|
class
|
||||||
|
FIND_ELEMENTS_LINKS_BY_PARTIAL_TEXT
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
ANY
|
||||||
|
redefine
|
||||||
|
default_create
|
||||||
|
end
|
||||||
|
|
||||||
|
create
|
||||||
|
default_create
|
||||||
|
|
||||||
|
feature
|
||||||
|
|
||||||
|
default_create
|
||||||
|
do
|
||||||
|
search
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Search by id
|
||||||
|
|
||||||
|
search
|
||||||
|
local
|
||||||
|
web_driver: WEB_DRIVER
|
||||||
|
wait: WEB_DRIVER_WAIT
|
||||||
|
do
|
||||||
|
--Create a new instance of a Web driver
|
||||||
|
create web_driver.make
|
||||||
|
|
||||||
|
-- Start session with chrome
|
||||||
|
web_driver.start_session_chrome
|
||||||
|
|
||||||
|
|
||||||
|
-- Go to EiffelRoom home page
|
||||||
|
web_driver.to_url ("http://www.eiffelroom.com/")
|
||||||
|
|
||||||
|
-- Find links
|
||||||
|
-- <a href="http://www.eiffel.com">Eiffel.com</a></li><li><a>
|
||||||
|
if attached {WEB_ELEMENT} web_driver.find_element ((create {SE_BY}).partial_link_text("Eiffel")) as l_link then
|
||||||
|
if attached l_link.get_attribute ("href") as l_ref then
|
||||||
|
print ("%Nhref:" + l_ref)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
-- <a href="#navigation">Skip to Navigation</a>
|
||||||
|
if attached {WEB_ELEMENT} web_driver.find_element ((create {SE_BY}).partial_link_text("Skip to")) as l_link then
|
||||||
|
if attached l_link.get_attribute ("href") as l_ref then
|
||||||
|
print ("%Nhref:" + l_ref)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
print ("%Nend process ..." )
|
||||||
|
io.read_line
|
||||||
|
-- close the window
|
||||||
|
web_driver.window_close
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
expected_title (driver : WEB_DRIVER; title : STRING_32) : BOOLEAN
|
||||||
|
do
|
||||||
|
if attached {STRING_32} driver.get_page_tile as l_title and then l_title.has_substring (title) then
|
||||||
|
Result := True
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
55
library/test/selenium/examples/find_elements_links_by_text.e
Normal file
55
library/test/selenium/examples/find_elements_links_by_text.e
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
note
|
||||||
|
description: "[
|
||||||
|
|
||||||
|
]"
|
||||||
|
|
||||||
|
class
|
||||||
|
FIND_ELEMENTS_LINKS_BY_TEXT
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
ANY
|
||||||
|
redefine
|
||||||
|
default_create
|
||||||
|
end
|
||||||
|
|
||||||
|
create
|
||||||
|
default_create
|
||||||
|
|
||||||
|
feature
|
||||||
|
|
||||||
|
default_create
|
||||||
|
do
|
||||||
|
search
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Search by id
|
||||||
|
|
||||||
|
search
|
||||||
|
local
|
||||||
|
web_driver: WEB_DRIVER
|
||||||
|
wait: WEB_DRIVER_WAIT
|
||||||
|
do
|
||||||
|
--Create a new instance of a Web driver
|
||||||
|
create web_driver.make
|
||||||
|
|
||||||
|
-- Start session with chrome
|
||||||
|
web_driver.start_session_chrome
|
||||||
|
|
||||||
|
-- Go to EiffelRoom home page
|
||||||
|
web_driver.to_url ("http://www.eiffelroom.com/")
|
||||||
|
|
||||||
|
-- Find links
|
||||||
|
-- <a href="http://www.eiffel.com">Eiffel.com</a></li><li><a>
|
||||||
|
if attached {WEB_ELEMENT} web_driver.find_element ((create {SE_BY}).link_text("Eiffel.com")) as l_link then
|
||||||
|
if attached l_link.get_attribute ("href") as l_ref then
|
||||||
|
print ("%Nhref:" + l_ref)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
print ("%Nend process ..." )
|
||||||
|
io.read_line
|
||||||
|
-- close the window
|
||||||
|
web_driver.window_close
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
6
library/test/selenium/examples/project.rc
Normal file
6
library/test/selenium/examples/project.rc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
STRINGTABLE
|
||||||
|
BEGIN
|
||||||
|
1 "This Program was made using EiffelStudio using Visual Studio C++"
|
||||||
|
END
|
||||||
6
library/test/selenium/examples/selenium_example.rc
Normal file
6
library/test/selenium/examples/selenium_example.rc
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
STRINGTABLE
|
||||||
|
BEGIN
|
||||||
|
1 "This Program was made using EiffelStudio using Visual Studio C++"
|
||||||
|
END
|
||||||
@@ -64,7 +64,7 @@ feature -- Commands
|
|||||||
-- TODO move this scenario to feature new_response
|
-- TODO move this scenario to feature new_response
|
||||||
if not (resp.status >= 400) then
|
if not (resp.status >= 400) then
|
||||||
if attached resp.header ("Location") as l_location then
|
if attached resp.header ("Location") as l_location then
|
||||||
resp := http_new_session (l_location).get ("", context_executor)
|
resp := http_session.get (l_location.substring ((host.count+1),l_location.count), context_executor)
|
||||||
Result := new_response ("", resp)
|
Result := new_response ("", resp)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -995,8 +995,8 @@ feature -- Commands
|
|||||||
until
|
until
|
||||||
index > l_json_array.count
|
index > l_json_array.count
|
||||||
loop
|
loop
|
||||||
if attached {JSON_OBJECT} l_json_array.i_th (index) as json_str and then attached json_str.item ("ELEMENT") as l_elem then
|
if attached {JSON_OBJECT} l_json_array.i_th (index) as json_str and then attached {JSON_STRING} json_str.item ("ELEMENT") as l_elem then
|
||||||
Result.force (create {WEB_ELEMENT}.make (l_elem.representation, Current, a_session_id))
|
Result.force (create {WEB_ELEMENT}.make (l_elem.item, Current, a_session_id))
|
||||||
end
|
end
|
||||||
index := index + 1
|
index := index + 1
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,17 +7,21 @@ note
|
|||||||
class
|
class
|
||||||
WEB_DRIVER
|
WEB_DRIVER
|
||||||
|
|
||||||
|
inherit
|
||||||
|
|
||||||
|
EXCEPTIONS
|
||||||
|
|
||||||
create
|
create
|
||||||
make, make_with_host
|
make, make_with_host
|
||||||
|
|
||||||
feature -- Initialization
|
feature -- Initialization
|
||||||
|
|
||||||
make
|
make
|
||||||
do
|
do
|
||||||
create api.make
|
create api.make
|
||||||
end
|
end
|
||||||
|
|
||||||
make_with_host (a_host : STRING)
|
make_with_host (a_host: STRING)
|
||||||
do
|
do
|
||||||
create api.make_with_host (a_host)
|
create api.make_with_host (a_host)
|
||||||
end
|
end
|
||||||
@@ -43,19 +47,46 @@ feature -- Initialize Session
|
|||||||
start_session_chrome
|
start_session_chrome
|
||||||
local
|
local
|
||||||
l_capabilities: SE_CAPABILITIES
|
l_capabilities: SE_CAPABILITIES
|
||||||
|
env: EXECUTION_ENVIRONMENT
|
||||||
|
retried: BOOLEAN
|
||||||
do
|
do
|
||||||
create l_capabilities.make
|
create l_capabilities.make
|
||||||
l_capabilities.set_browser_name ("chrome")
|
l_capabilities.set_browser_name ("chrome")
|
||||||
if attached api.create_session_with_desired_capabilities (l_capabilities) as l_session then
|
if not retried then
|
||||||
session := l_session
|
session := api.create_session_with_desired_capabilities (l_capabilities)
|
||||||
|
if not is_session_active then
|
||||||
|
raise ("Session not active")
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
session := api.create_session_with_desired_capabilities (l_capabilities)
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
retried := true
|
||||||
|
create env
|
||||||
|
env.sleep (1000)
|
||||||
|
retry
|
||||||
end
|
end
|
||||||
|
|
||||||
start_session_chrome_with_desired_capabilities (a_desired_capabilities: SE_CAPABILITIES)
|
start_session_chrome_with_desired_capabilities (a_desired_capabilities: SE_CAPABILITIES)
|
||||||
require
|
require
|
||||||
browser_name_chrome: attached a_desired_capabilities.browser_name as l_browser_name and then l_browser_name ~ "chrome"
|
browser_name_chrome: attached a_desired_capabilities.browser_name as l_browser_name and then l_browser_name ~ "chrome"
|
||||||
|
local
|
||||||
|
env: EXECUTION_ENVIRONMENT
|
||||||
|
retried: BOOLEAN
|
||||||
do
|
do
|
||||||
|
if not retried then
|
||||||
session := api.create_session_with_desired_capabilities (a_desired_capabilities)
|
session := api.create_session_with_desired_capabilities (a_desired_capabilities)
|
||||||
|
if not is_session_active then
|
||||||
|
raise ("Session not active")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
session := api.create_session_with_desired_capabilities (a_desired_capabilities)
|
||||||
|
end
|
||||||
|
rescue
|
||||||
|
retried := true
|
||||||
|
create env
|
||||||
|
env.sleep (1000)
|
||||||
|
retry
|
||||||
end
|
end
|
||||||
|
|
||||||
start_session_ie
|
start_session_ie
|
||||||
@@ -366,83 +397,79 @@ feature -- Common
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
find_element (by: STRING_32) : detachable WEB_ELEMENT
|
find_element (by: STRING_32): detachable WEB_ELEMENT
|
||||||
-- Find the first WebElement using the given strategy.
|
-- Find the first WebElement using the given strategy.
|
||||||
require
|
require
|
||||||
exist_session : is_session_active
|
exist_session: is_session_active
|
||||||
valid_strategy : (create {SE_BY}).is_valid_strategy (by)
|
valid_strategy: (create {SE_BY}).is_valid_strategy (by)
|
||||||
do
|
do
|
||||||
if attached session as l_session then
|
if attached session as l_session then
|
||||||
Result := api.search_element (l_session.session_id, by)
|
Result := api.search_element (l_session.session_id, by)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
find_elements (by: STRING_32) : detachable LIST[WEB_ELEMENT]
|
find_elements (by: STRING_32): detachable LIST [WEB_ELEMENT]
|
||||||
-- Find all elements within the current page using the given mechanism..
|
-- Find all elements within the current page using the given mechanism..
|
||||||
require
|
require
|
||||||
exist_session : is_session_active
|
exist_session: is_session_active
|
||||||
valid_strategy : (create {SE_BY}).is_valid_strategy (by)
|
valid_strategy: (create {SE_BY}).is_valid_strategy (by)
|
||||||
do
|
do
|
||||||
if attached session as l_session then
|
if attached session as l_session then
|
||||||
Result := api.search_elements (l_session.session_id, by)
|
Result := api.search_elements (l_session.session_id, by)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get_current_url: detachable STRING_32
|
||||||
|
|
||||||
get_current_url : detachable STRING_32
|
|
||||||
-- Retrieve the URL of the current page.
|
-- Retrieve the URL of the current page.
|
||||||
require
|
require
|
||||||
exist_session : is_session_active
|
exist_session: is_session_active
|
||||||
do
|
do
|
||||||
if attached session as l_session then
|
if attached session as l_session then
|
||||||
Result := api.retrieve_url (l_session.session_id)
|
Result := api.retrieve_url (l_session.session_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get_page_source : detachable STRING_32
|
get_page_source: detachable STRING_32
|
||||||
-- Get the current page source.
|
-- Get the current page source.
|
||||||
require
|
require
|
||||||
exist_session : is_session_active
|
exist_session: is_session_active
|
||||||
do
|
do
|
||||||
if attached session as l_session then
|
if attached session as l_session then
|
||||||
Result := api.page_source (l_session.session_id)
|
Result := api.page_source (l_session.session_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get_page_tile : detachable STRING_32
|
get_page_tile: detachable STRING_32
|
||||||
--Get the current page title
|
--Get the current page title
|
||||||
require
|
require
|
||||||
exist_session : is_session_active
|
exist_session: is_session_active
|
||||||
do
|
do
|
||||||
if attached session as l_session then
|
if attached session as l_session then
|
||||||
Result := api.page_title (l_session.session_id)
|
Result := api.page_title (l_session.session_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get_window_handle: detachable STRING_32
|
||||||
|
|
||||||
get_window_handle : detachable STRING_32
|
|
||||||
require
|
require
|
||||||
exist_session : is_session_active
|
exist_session: is_session_active
|
||||||
do
|
do
|
||||||
if attached session as l_session then
|
if attached session as l_session then
|
||||||
Result := api.retrieve_window_handle (l_session.session_id)
|
Result := api.retrieve_window_handle (l_session.session_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get_window_handles : detachable LIST[STRING_32]
|
get_window_handles: detachable LIST [STRING_32]
|
||||||
require
|
require
|
||||||
exist_session : is_session_active
|
exist_session: is_session_active
|
||||||
do
|
do
|
||||||
if attached session as l_session then
|
if attached session as l_session then
|
||||||
Result := api.retrieve_window_handles (l_session.session_id)
|
Result := api.retrieve_window_handles (l_session.session_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
feature {WEB_DRIVER, WEB_DRIVER_WAIT}
|
feature {WEB_DRIVER, WEB_DRIVER_WAIT}
|
||||||
session_wait (duration : INTEGER_64)
|
|
||||||
|
session_wait (duration: INTEGER_64)
|
||||||
do
|
do
|
||||||
if attached session as l_session then
|
if attached session as l_session then
|
||||||
api.set_session_timeouts_async_script (l_session.session_id, duration.as_integer_32)
|
api.set_session_timeouts_async_script (l_session.session_id, duration.as_integer_32)
|
||||||
@@ -452,5 +479,9 @@ feature {WEB_DRIVER, WEB_DRIVER_WAIT}
|
|||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
session: detachable SE_SESSION
|
session: detachable SE_SESSION
|
||||||
api : SE_JSON_WIRE_PROTOCOL
|
|
||||||
|
status: BOOLEAN
|
||||||
|
|
||||||
|
api: SE_JSON_WIRE_PROTOCOL
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ feature -- Access
|
|||||||
if condition.item([]) then
|
if condition.item([]) then
|
||||||
found := True
|
found := True
|
||||||
end
|
end
|
||||||
create l_time2.make_now
|
l_time2.make_now
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -40,16 +40,16 @@ feature -- Web Element API
|
|||||||
api.element_click (session_id, element)
|
api.element_click (session_id, element)
|
||||||
end
|
end
|
||||||
|
|
||||||
find_element (by : SE_BY) : detachable WEB_ELEMENT
|
find_element (by : STRING_32) : detachable WEB_ELEMENT
|
||||||
-- Find the first WebElement using the given method.
|
-- Find the first WebElement using the given method.
|
||||||
do
|
do
|
||||||
Result := api.search_element (session_id,"")
|
Result := api.search_element (session_id,by)
|
||||||
end
|
end
|
||||||
|
|
||||||
find_elementS (by : SE_BY) : detachable LIST[WEB_ELEMENT]
|
find_elements (by : STRING_32) : detachable LIST[WEB_ELEMENT]
|
||||||
-- Find all elements within the current context using the given mechanism.
|
-- Find all elements within the current context using the given mechanism.
|
||||||
do
|
do
|
||||||
Result := api.search_elements (session_id,"")
|
Result := api.search_elements (session_id,by)
|
||||||
end
|
end
|
||||||
|
|
||||||
get_attribute (name : STRING_32) : detachable STRING_32
|
get_attribute (name : STRING_32) : detachable STRING_32
|
||||||
|
|||||||
Reference in New Issue
Block a user