From 60fa0767960dfcf7d39f0be465322a29134f0d10 Mon Sep 17 00:00:00 2001 From: jvelilla Date: Thu, 23 May 2013 07:49:12 -0300 Subject: [PATCH 1/3] Update readme.md --- library/test/selenium/readme.md | 110 +++++++++++++++++++------------- 1 file changed, 64 insertions(+), 46 deletions(-) diff --git a/library/test/selenium/readme.md b/library/test/selenium/readme.md index 19b30d70..9b14aeb7 100644 --- a/library/test/selenium/readme.md +++ b/library/test/selenium/readme.md @@ -26,53 +26,71 @@ The examples and guide are based on http://docs.seleniumhq.org/docs/03_webdriver WebDriver is a tool for automating web application testing, and in particular to verify that they work as expected. - - class - EXAMPLE_SEARCH + class + EXAMPLE_SEARCH + inherit + ANY + redefine + default_create + end + feature + default_create + do + search + end + feature -- Example + 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 Google + web_driver.to_url ("http://www.google.com/") + + -- Find the text input element by its name + if attached web_driver.find_element ((create{SE_BY}).name ("q")) as l_element then + + -- Enter something to search for + l_element.send_keys(<<"Eiffel Room">>) + + -- Now submit the form. WebDriver will find the form for us from the element + l_element.submit + + end + if attached web_driver.get_page_tile as l_title then + print ("%NPage title is:" + l_title) + end + + -- Google's search is rendered dynamically with JavaScript. + -- Wait for the page to load, timeout after 10 seconds + create wait.make (web_driver,10) + wait.until_when (agent expected_title (web_driver, "Eiffel Room")) + + + if attached web_driver.get_page_tile as l_title then + print ("%NPage title is:" + l_title) + end + + -- 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 + - feature -- Example - 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 Google - web_driver.to_url ("http://www.google.com/") - - -- Find the text input element by its name - if attached web_driver.find_element ((create{SE_BY}).name ("q")) as l_element then - - -- Enter something to search for - l_element.send_keys(<<"Eiffel Room">>) - - -- Now submit the form. WebDriver will find the form for us from the element - l_element.submit - - end - if attached web_driver.get_page_tile as l_title then - print ("%NPage title is:" + l_title) - end - - -- Google's search is rendered dynamically with JavaScript. - -- Wait for the page to load, timeout after 10 seconds - create wait.make (web_driver,10) - wait.until_when ("Eiffel Room") - - - if attached web_driver.get_page_tile as l_title then - print ("%NPage title is:" + l_title) - end - - -- close the window - web_driver.window_close - end - end ### Selenium-WebDriver API Commands and Operations From c741e4159783e462d6ddeb0c41d5bb0c5bd9d1f4 Mon Sep 17 00:00:00 2001 From: jvelilla Date: Thu, 23 May 2013 07:50:18 -0300 Subject: [PATCH 2/3] Update readme.md --- library/test/selenium/readme.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/library/test/selenium/readme.md b/library/test/selenium/readme.md index 9b14aeb7..9e5c551b 100644 --- a/library/test/selenium/readme.md +++ b/library/test/selenium/readme.md @@ -26,19 +26,19 @@ The examples and guide are based on http://docs.seleniumhq.org/docs/03_webdriver WebDriver is a tool for automating web application testing, and in particular to verify that they work as expected. - class - EXAMPLE_SEARCH - inherit - ANY - redefine + class + EXAMPLE_SEARCH + inherit + ANY + redefine + default_create + end + feature default_create - end - feature - default_create - do - search - end - feature -- Example + do + search + end + feature -- Example search local web_driver : WEB_DRIVER From caac6964657d13c8085662c54521e9ce4cea4a35 Mon Sep 17 00:00:00 2001 From: jvelilla Date: Thu, 23 May 2013 07:52:30 -0300 Subject: [PATCH 3/3] Update readme.md --- library/test/selenium/readme.md | 130 ++++++++++++++++---------------- 1 file changed, 66 insertions(+), 64 deletions(-) diff --git a/library/test/selenium/readme.md b/library/test/selenium/readme.md index 9e5c551b..b5f31f52 100644 --- a/library/test/selenium/readme.md +++ b/library/test/selenium/readme.md @@ -26,71 +26,73 @@ The examples and guide are based on http://docs.seleniumhq.org/docs/03_webdriver WebDriver is a tool for automating web application testing, and in particular to verify that they work as expected. - class - EXAMPLE_SEARCH - inherit - ANY - redefine - default_create - end - feature - default_create - do - search - end - feature -- Example - 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 Google - web_driver.to_url ("http://www.google.com/") - - -- Find the text input element by its name - if attached web_driver.find_element ((create{SE_BY}).name ("q")) as l_element then - - -- Enter something to search for - l_element.send_keys(<<"Eiffel Room">>) - - -- Now submit the form. WebDriver will find the form for us from the element - l_element.submit - - end - if attached web_driver.get_page_tile as l_title then - print ("%NPage title is:" + l_title) - end - - -- Google's search is rendered dynamically with JavaScript. - -- Wait for the page to load, timeout after 10 seconds - create wait.make (web_driver,10) - wait.until_when (agent expected_title (web_driver, "Eiffel Room")) - - - if attached web_driver.get_page_tile as l_title then - print ("%NPage title is:" + l_title) - end - - -- 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 - + class + EXAMPLE_SEARCH + inherit + + ANY + redefine + default_create + end + + feature + + default_create + do + search + end + + feature -- Example + + 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 Google + web_driver.to_url ("http://www.google.com/") + + -- Find the text input element by its name + if attached web_driver.find_element ((create {SE_BY}).name ("q")) as l_element then + + -- Enter something to search for + l_element.send_keys (<<"Eiffel Room">>) + + -- Now submit the form. WebDriver will find the form for us from the element + l_element.submit + end + if attached web_driver.get_page_tile as l_title then + print ("%NPage title is:" + l_title) + end + + -- Google's search is rendered dynamically with JavaScript. + -- Wait for the page to load, timeout after 10 seconds + create wait.make (web_driver, 10) + wait.until_when (agent expected_title(web_driver, "Eiffel Room")) + if attached web_driver.get_page_tile as l_title then + print ("%NPage title is:" + l_title) + end + + -- 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 + + ### Selenium-WebDriver API Commands and Operations