Update readme.md

This commit is contained in:
jvelilla
2013-05-23 07:52:30 -03:00
parent c741e41597
commit caac696465

View File

@@ -28,21 +28,27 @@ WebDriver is a tool for automating web application testing, and in particular to
class class
EXAMPLE_SEARCH EXAMPLE_SEARCH
inherit inherit
ANY ANY
redefine redefine
default_create default_create
end end
feature feature
default_create default_create
do do
search search
end end
feature -- Example feature -- Example
search search
local local
web_driver : WEB_DRIVER web_driver: WEB_DRIVER
wait : WEB_DRIVER_WAIT 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
@@ -54,14 +60,13 @@ WebDriver is a tool for automating web application testing, and in particular to
web_driver.to_url ("http://www.google.com/") web_driver.to_url ("http://www.google.com/")
-- Find the text input element by its name -- Find the text input element by its name
if attached web_driver.find_element ((create{SE_BY}).name ("q")) as l_element then if attached web_driver.find_element ((create {SE_BY}).name ("q")) as l_element then
-- Enter something to search for -- Enter something to search for
l_element.send_keys(<<"Eiffel Room">>) l_element.send_keys (<<"Eiffel Room">>)
-- Now submit the form. WebDriver will find the form for us from the element -- Now submit the form. WebDriver will find the form for us from the element
l_element.submit l_element.submit
end end
if attached web_driver.get_page_tile as l_title then if attached web_driver.get_page_tile as l_title then
print ("%NPage title is:" + l_title) print ("%NPage title is:" + l_title)
@@ -69,10 +74,8 @@ WebDriver is a tool for automating web application testing, and in particular to
-- Google's search is rendered dynamically with JavaScript. -- Google's search is rendered dynamically with JavaScript.
-- Wait for the page to load, timeout after 10 seconds -- Wait for the page to load, timeout after 10 seconds
create wait.make (web_driver,10) create wait.make (web_driver, 10)
wait.until_when (agent expected_title (web_driver, "Eiffel Room")) wait.until_when (agent expected_title(web_driver, "Eiffel Room"))
if attached web_driver.get_page_tile as l_title then if attached web_driver.get_page_tile as l_title then
print ("%NPage title is:" + l_title) print ("%NPage title is:" + l_title)
end end
@@ -81,13 +84,12 @@ WebDriver is a tool for automating web application testing, and in particular to
web_driver.window_close web_driver.window_close
end end
expected_title (driver : WEB_DRIVER; title : STRING_32) : BOOLEAN expected_title (driver: WEB_DRIVER; title: STRING_32): BOOLEAN
do do
if attached {STRING_32} driver.get_page_tile as l_title and then l_title.has_substring (title) then if attached {STRING_32} driver.get_page_tile as l_title and then l_title.has_substring (title) then
Result := True Result := True
end end
end end
end end