Improve the example, Added a new class WEB_DRIVER_WAIT, still under development.
Update web driver, to define time outs.
This commit is contained in:
@@ -11,6 +11,7 @@ feature -- Example
|
|||||||
search
|
search
|
||||||
local
|
local
|
||||||
web_driver : WEB_DRIVER
|
web_driver : WEB_DRIVER
|
||||||
|
wait : WEB_DRIVER_WAIT
|
||||||
do
|
do
|
||||||
--Create a new instance of a Web driver
|
--Create a new instance of a Web driver
|
||||||
create web_driver.make
|
create web_driver.make
|
||||||
@@ -31,9 +32,15 @@ feature -- Example
|
|||||||
l_element.submit
|
l_element.submit
|
||||||
|
|
||||||
end
|
end
|
||||||
|
if attached web_driver.get_page_tile as l_title then
|
||||||
|
print ("%NPage title is:" + l_title)
|
||||||
|
end
|
||||||
|
create wait.make (web_driver,0)
|
||||||
|
wait.wait ("Eiffel Room")
|
||||||
|
|
||||||
if attached web_driver.get_page_tile as l_title then
|
|
||||||
print ("Page title is:" + l_title)
|
if attached web_driver.get_page_tile as l_title then
|
||||||
|
print ("%NPage title is:" + l_title)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- close the window
|
-- close the window
|
||||||
|
|||||||
@@ -441,6 +441,14 @@ feature -- Common
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
feature {WEB_DRIVER, WEB_DRIVER_WAIT}
|
||||||
|
session_wait (duration : INTEGER_64)
|
||||||
|
do
|
||||||
|
if attached session as l_session then
|
||||||
|
api.set_session_timeouts_async_script (l_session.session_id, duration.as_integer_32)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
feature {NONE} -- Implementation
|
feature {NONE} -- Implementation
|
||||||
|
|
||||||
session: detachable SE_SESSION
|
session: detachable SE_SESSION
|
||||||
|
|||||||
54
library/test/selenium/src/web_driver_wait.e
Normal file
54
library/test/selenium/src/web_driver_wait.e
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
note
|
||||||
|
description: "Summary description for {WEB_DRIVER_WAIT}."
|
||||||
|
author: ""
|
||||||
|
date: "$Date$"
|
||||||
|
revision: "$Revision$"
|
||||||
|
|
||||||
|
class
|
||||||
|
WEB_DRIVER_WAIT
|
||||||
|
|
||||||
|
create
|
||||||
|
make
|
||||||
|
feature {NONE} -- Initialization
|
||||||
|
make ( driver : like web_driver; a_duration : INTEGER_64)
|
||||||
|
do
|
||||||
|
web_driver := driver
|
||||||
|
duration := a_duration
|
||||||
|
initialize
|
||||||
|
ensure
|
||||||
|
driver_set : driver = web_driver
|
||||||
|
duration_set : duration = a_duration
|
||||||
|
end
|
||||||
|
|
||||||
|
feature -- Access
|
||||||
|
wait (condition : STRING)
|
||||||
|
|
||||||
|
local
|
||||||
|
found : BOOLEAN
|
||||||
|
do
|
||||||
|
condition.to_lower
|
||||||
|
from
|
||||||
|
if attached {STRING_32} web_driver.get_page_tile as l_title then
|
||||||
|
l_title.to_lower
|
||||||
|
found := l_title.has_substring (condition)
|
||||||
|
end
|
||||||
|
until
|
||||||
|
found
|
||||||
|
loop
|
||||||
|
if attached web_driver.get_page_tile as l_title then
|
||||||
|
l_title.to_lower
|
||||||
|
found := l_title.has_substring (condition)
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
feature {NONE}-- Implementation
|
||||||
|
web_driver : WEB_DRIVER
|
||||||
|
duration : INTEGER_64
|
||||||
|
|
||||||
|
initialize
|
||||||
|
do
|
||||||
|
web_driver.session_wait (duration)
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user