Need info about how to get browser version in watir classic and about ie8 and ie9 support.

177 views
Skip to first unread message

Bhavesh

unread,
Apr 10, 2014, 12:39:40 AM4/10/14
to watir-...@googlegroups.com

Hi,

 

I have Ruby 1.8.7 with watir 1.6.5.

 

I need following info:

 

1.       How do I get browser version I mean IE version script is running i.e ie7 or ie8 or ie9 etc.

 

2.       I have Ruby 1.8.7 with watir 1.6.5, where I have lot of TC automated.  I need to run these testcases in Ie8 and IE9, I know I have tweak my script to run in these browser but does watir 1.6.5 supports ie8 and ie9?  I mean it is not like I get errors when I try to run script?

Can someone please help me out with this.

 

Thanks

Bhavesh

Super Kevy

unread,
Apr 10, 2014, 9:35:22 AM4/10/14
to watir-...@googlegroups.com
First your running some ancient Ruby and Watir.  Consider moving forward.



Code for Watir WebDriver IE Browser :

require 'rubygems'
require 'watir-webdriver'
br=Watir::Browser.new :ie
ie=br.execute_script("return navigator.userAgent;")
puts ie.split("MSIE ")[1].split(";")[0]

Oscar Rieken

unread,
Apr 10, 2014, 9:50:01 AM4/10/14
to watir-...@googlegroups.com
I personally would just drop down to webdriver and ask it what its caps are

[1] pry(main)> require 'watir-webdriver'
=> true
[2] pry(main)> b = Watir::Browser.new :chrome
=> #<Watir::Browser:0x..f9c0b79e466ac11da url="data:," title="data:,">
[3] pry(main)> b.driver.capabilities
=> #<Selenium::WebDriver::Remote::Capabilities:0x007fa1959cc780
 @capabilities=
  {:browser_name=>"chrome",
   :version=>"33.0.1750.152",
   :platform=>:"mac os x",
   :javascript_enabled=>true,
   :css_selectors_enabled=>true,
   :takes_screenshot=>true,
   :native_events=>true,
   :rotatable=>false,
   :firefox_profile=>nil,
   :proxy=>nil,
   "acceptSslCerts"=>true,
   "applicationCacheEnabled"=>false,
   "browserConnectionEnabled"=>false,
   "chrome"=>
    {"userDataDir"=>
      "/var/folders/_q/cgwwbx596v995n55n32kd1cm0000gn/T/.org.chromium.Chromium.rKUMb4"},
   "databaseEnabled"=>false,
   "handlesAlerts"=>true,
   "locationContextEnabled"=>true,
   "takesHeapSnapshot"=>true,
   "webStorageEnabled"=>true}>


--
--
Before posting, please read http://watir.com/support. In short: search before you ask, be nice.
 
watir-...@googlegroups.com
http://groups.google.com/group/watir-general
watir-genera...@googlegroups.com

---
You received this message because you are subscribed to the Google Groups "Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email to watir-genera...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Oscar Rieken

unread,
Apr 10, 2014, 9:51:00 AM4/10/14
to watir-...@googlegroups.com
and on a second note I would probably update to more recent versions of ruby/watir imo

Jarmo Pertman

unread,
Apr 10, 2014, 5:14:39 PM4/10/14
to watir-...@googlegroups.com
You can also use Watir::IE.version or Watir::Browser.version depending of the version of watir/watir-classic used.

Jarmo Pertman
-----
IT does really matter - http://itreallymatters.net

Bhavesh

unread,
Apr 11, 2014, 3:06:39 AM4/11/14
to watir-...@googlegroups.com
Thanks Jarmo.

Thanks everyone for your comments, by the way we have another UI where we are using watir webdriver. But this is very old ui with no work done and it is left as it is with old version of automation framework.

thanks
bhavesh

Bhavesh

unread,
Apr 11, 2014, 3:22:48 AM4/11/14
to watir-...@googlegroups.com
Hi Jarmo,

I tried using what you said but it throws error.

if i use Watir::IE.version, then it throws error for unknown constant version.

And if i use Watir::IE::Version then it shows watir version insetad of IE version.

And if i use Watir::Browser.version or Watir::Browser::Version the also some error like uninitialized constant Watir::Browser::VERSION etc.

So what is the right method to get browser version?

Please suggest

thanks
bhavesh
Reply all
Reply to author
Forward
0 new messages