Created new classes to represent a web driver.

Added Examples, clean code
This commit is contained in:
jvelilla
2013-04-29 18:02:33 -03:00
parent 9180667ac4
commit 31c2be768f
15 changed files with 1012 additions and 48 deletions

View File

@@ -0,0 +1,27 @@
note
description : "project application root class"
date : "$Date$"
revision : "$Revision$"
class
APPLICATION
inherit
ARGUMENTS
create
make
feature {NONE} -- Initialization
make
-- Run application.
do
execute_example1
end
execute_example1
do
(create {EXAMPLE_1}).test
end
end

View File

@@ -0,0 +1,58 @@
note
description: "Summary description for {EXAMPLE_1}."
author: ""
date: "$Date$"
revision: "$Revision$"
class
EXAMPLE_1
feature -- Access
test
local
web_driver: SE_JSON_WIRE_PROTOCOL
capabilities: SE_CAPABILITIES
l_session : SE_SESSION
do
create web_driver.make
if attached web_driver.status as l_status then
create capabilities.make
capabilities.set_browser_name ("chrome")
l_session:= web_driver.create_session_with_desired_capabilities (capabilities)
if attached l_session as l_s then
-- navigate to www.google.com
web_driver.navigate_to_url (l_s.session_id, "http://www.google.com/")
-- Find the text input element by its name
if attached {WEB_ELEMENT} web_driver.search_element (l_s.session_id, (create {SE_BY}).name ("q")) as l_element then
-- search something
web_driver.send_event(l_s.session_id, l_element.element,<<"Eiffel Room">>)
-- Submit Form
web_driver.element_submit (l_s.session_id, l_element.element)
if attached web_driver.page_title (l_s.session_id) as l_page then
print ("Page Name" + l_page)
end
end
end
end
end
-- // And now use this to visit Google
-- driver.get("http://www.google.com");
-- // Find the text input element by its name
-- WebElement element = driver.findElement(By.name("q"));
-- // Enter something to search for
-- element.sendKeys("Cheese!");
-- // Now submit the form. WebDriver will find the form for us from the element
-- element.submit();
-- // Check the title of the page
-- System.out.println("Page title is: " + driver.getTitle());
end

View File

@@ -0,0 +1,19 @@
<?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">
<target name="project">
<root feature="make" class="APPLICATION"/>
<option warning="true">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option>
<setting name="console_application" value="true"/>
<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>
</file_rule>
</cluster>
</target>
</system>