Thanks Pallavi and Chris for clear explanation,
I actually found out that webdriver are more consistent with watir
then firewatir.
firewatir does not regconize "frame nested" element and it run very
slow comparing with webdriver.
Here are the errors:
--
/var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/element.rb:907:in
`assert_exists': Unable to locate element, using :id,
"cblModules_0" (Watir::Exception::UnknownObjectException)
from /var/lib/gems/1.8/gems/firewatir-1.6.5/lib/firewatir/elements/
radio_check_common.rb:153:in `clear'
---
And this script is the one that I run again 'watir' and 'webdriver'
without any issues
---
main_frame = browser.frame( :id, "Main_Body" )
puts "5. Uncheck all options ( 15 totals )"
0.upto( 15 ) do |number|
main_frame.checkbox( :id, "cblModules" + "_" + number.to_s ).clear
end
---
The only difference that I found right now is the way 'watir' and
'webdriver' handling text is different.
This works well with 'watir'
0) if main_frame.contains_text( "str" )
But with webdriver, it failed no matter what I tried:
1) main_frame.text.include( "str" )
or
2) browser.text.include( "str" )
* Errors :
0) undefined method `contains_text' for #
(NoMethodError)
1) var/lib/gems/1.8/gems/watir-webdriver-0.0.6/lib/watir-webdriver/
base_element.rb:186:in `text': undefined method `text' for
#
(NoMethodError)
2) /var/lib/gems/1.8/gems/watir-webdriver-0.0.6/lib/watir-webdriver/
base_element.rb:312:in `assert_exists': unable to locate element,
using {:tag_name=>"a", :text=>"Customize Home Page"}
(Watir::Exception::UnknownObjectException)
from /var/lib/gems/1.8/gems/watir-webdriver-0.0.6/lib/watir-webdriver/
base_element.rb:195:in `click'
Whole script:
-
puts "4. Click on 'Customize Home Page' link"
browser.link( :text, "Customize Home Page" ).click
main_frame = browser.frame( :id, "Main_Body" )
puts "5. Uncheck all options ( 15 totals )"
0.upto( 15 ) do |number|
main_frame.checkbox( :id, "cblModules" + "_" + number.to_s ).clear
end
module_array = [ "24-Hour Market Watch",
"Agent Tools",
"Appointments and Tasks",
"Client Portal Activity",
"Listing Locator",
"Newly Matched Listings",
"Office Tools",
"Prospect Management",
"Staff Tools",
"Support Center",
"Weather",
"Your Listings",
"Your Office Listings",
"Your Recent Searches",
"Your Saved Hotsheets",
"Your Saved Searches" ]
puts "6. Check each individual module and check to see whether it
appear in 'Home Page'"
0.upto( 15 ) do |number|
main_frame.checkbox( :id, "cblModules" + "_" + number.to_s ).set
browser.button( :id, "btnSave" ).click
if browser.text.include?( module_array[ number ] )
puts " -> Test " + module_array[ number ] + " passed."
else
puts " -> Test " + module_array[ number ] + " failed."
end
browser.link( :text, "Customize Home Page" ).click
end
On Aug 14, 8:32 am, Chris wrote:
> > ps: Why don't people make them become consistent and unique for all
> > browsers ( IE, FF, Safari... )?
>
> Unlurking for a minute because this is an interesting question.
>
> IE has a proprietary API published by Microsoft. Microsoft also has a
> long history of jacking anyone who emulates their public APIs by
> changing them so as to make critical applications no longer function
> with MS products. So no one is interested in emulating the
> proprietary IE API.
>
> Firefox runs so many places that it is essentially an OS unto itself.
> To drive FF via its API, you have to pretty much turn it into a telnet
> server and turn the tests running in the browser into little telnet
> clients.
>
> Safari has its own Mac-specific API, and shares a rendering engine
> w