Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8447203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:07:38+00:00 2026-06-10T10:07:38+00:00

def wait_for_element_present(element) wait = Selenium::WebDriver::Wait.new(:timeout => 30); wait.until{driver.find_element(element)}; end Please take a look at

  • 0
def wait_for_element_present(element)
    wait = Selenium::WebDriver::Wait.new(:timeout => 30);
    wait.until{driver.find_element(element)};
end

Please take a look at the Ruby code above, I have two questions:

(1) As for “Selenium::WebDriver::Wait.new(:timeout => 30)”, what does the “=>” mean here? I know “:timeout” is a ruby symbol, but when using it following by a “=>” and a value “30”, I get confused. Is this some kind of trick about ruby symbol?

(2) We also have the symbol “=>” when defining hash right? Like:

cars = {
'altima' => 'nissan',
'camry' => 'toyota',
'rx7' => 'mazda'
}
puts cars['rx7']   =>   mazda

Does the “=>” here has the same meaning as that in question (1)?

I’m a ruby newbie, any comments would be appreciated. Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:07:39+00:00Added an answer on June 10, 2026 at 10:07 am

    Yes, it has the same meaning. In both cases, it’s definition of a hash. Ruby allows to omit curly braces of hash literal, if it is the last parameter in method’s signature.

    Example:

    def my_method a, b, h
      puts a
      puts b
      puts h
    end
    
    
    my_method(1, 2, :timeout => 30)
    # my_method(1, 2, timeout: 30) # alternative syntax for ruby 1.9+
    # >> 1
    # >> 2
    # >> {:timeout=>30}
    

    Note that it only works for last parameter which is hash. If you have several hashes at the end, you have to use normal form (with curly braces) for all but the last.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

def update @album = Album.find(params[:id]) if @album.update_attributes(params[:album]) redirect_to(:action=>'list') else render(:action=>'edit') end end A Rails
def test_method [a, b, c].map {|i| yield(i) } end If I call test_method like
def any? if block_given? method_missing(:any?) { |*block_args| yield(*block_args) } else !empty? end end In
I have a written a Code in Selenium Web driver to test the health
I want to run multiple threads simultaneously, and wait until all of them are
def download_if_dne(href, filename): if os.path.isfile(filename): # print 'already downloaded:', href return False else: if
def self.jq_column_models COLUMN_NAME.collect {|x| {:name => x.to_s, :width => 80, :format => 'integer' if
def On_Instrumentation_StartAnimation(): Syntax : On_Instrumentation_StartAnimation() Purpose : Fired if the animation is started Parameters
def myFunc( a, b ): def innerFunc( c ): print c innerFunc( 2 )
def partial(template, *args) options = args.extract_options! options.merge!(:layout => false) if collection = options.delete(:collection) then

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.