ruby - How to check a existence of Selenium WebDriver instance -



ruby - How to check a existence of Selenium WebDriver instance -

i want quit selenium webdriver instance if exists.

d = selenium::webdriver.for :phantomjs => #<selenium::webdriver::driver:0x1c387eba browser=:phantomjs> irb(main):023:0> d.quit => nil irb(main):024:0> d.quit errno::econnrefused: no connection made because target machine actively refused it. - connect(2)

without checking existence of driver, causes error this. want write d.quit if d.exists?, seems there no such method. http://rubydoc.info/gems/selenium-webdriver/0.0.28/selenium/webdriver/driver

how can quit webdriver peacefully?

by next @yevgeniy's advice, i've written this.

class selenium::webdriver::driver def exists? self.window_handle homecoming true rescue errno::econnrefused homecoming false end end

ruby selenium

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -