Added a simple search example.

Updated web_driver, use the API as delegation instead of inheritance.
Updated web_element class.
This commit is contained in:
jvelilla
2013-04-30 10:19:34 -03:00
parent 31c2be768f
commit dcdc700bac
7 changed files with 121 additions and 74 deletions

View File

@@ -17,11 +17,16 @@ feature {NONE} -- Initialization
make
-- Run application.
do
execute_example1
execute_search
end
execute_example1
do
(create {EXAMPLE_1}).test
end
execute_search
do
(create {EXAMPLE_SEARCH}).search
end
end

View File

@@ -12,7 +12,7 @@ feature -- Access
local
web_driver: SE_JSON_WIRE_PROTOCOL
capabilities: SE_CAPABILITIES
l_session : SE_SESSION
l_session : detachable SE_SESSION
do
create web_driver.make
if attached web_driver.status as l_status then

View File

@@ -0,0 +1,44 @@
note
description: "Summary description for {EXAMPLE_SEARCH}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
EXAMPLE_SEARCH
feature -- Example
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 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 ("Page title is:" + l_title)
end
-- close the window
web_driver.window_close
end
end

View File

@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-5-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-5-0 http://www.eiffel.com/developers/xml/configuration-1-5-0.xsd" name="project" uuid="61EFD50A-C916-494A-91D6-3E12E0738F4D">
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-10-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-10-0 http://www.eiffel.com/developers/xml/configuration-1-10-0.xsd" name="project" uuid="61EFD50A-C916-494A-91D6-3E12E0738F4D">
<target name="project">
<root feature="make" class="APPLICATION"/>
<option warning="true">
<root class="APPLICATION" feature="make"/>
<option warning="true" is_attached_by_default="true" void_safety="all" syntax="transitional">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="selenium" location="..\selenium-safe.ecf"/>
<library name="base" location="$ISE_LIBRARY/library/base/base-safe.ecf"/>
<cluster name="project" location=".\" recursive="true">
<file_rule>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
<exclude>/CVS$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
</cluster>
</target>