Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get browser for logging in Watir?

Tags:

ruby

watir

I want to show which browser is being used in a series of tests, i.e., whether the browser is Chrome or Firefox.

I have:

def initialize(browser)
  @browser = browser
  $log.info("\n"+"#{browser}"+" Browser initialized") 
end

It returns Watir:

<Watir::Browser:0x24553a5d286c4da2 url="https://url" title="page name">

Are there any ideas how to get it to return the browser name instead?

like image 837
samayres1992 Avatar asked Nov 18 '25 06:11

samayres1992


1 Answers

There is also method in Watir API, which also works in watir-classic:

browser.name # => chrome
like image 58
Jarmo Pertman Avatar answered Nov 21 '25 06:11

Jarmo Pertman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!