Justin Ko is a software tester specializing in exploratory testing and Ruby/Watir test automation.


13 Responses to About

  1. Just found the blog and plan to catch up on all of it. You often take a different approach than I do to Stack answers and I’ve really enjoyed the alternate perspective & learning experience – thanks!

  2. alessiodini says:

    Hi man,
    I’m trying to contact you! 🙂
    You made a reply on my question about watir on stackoverflow.com !!
    Please i need help on watir , can you give me a mail address?
    Mine is alessio.dini@gmail.com / http://www.alessiodini.wordpress.com
    Thank you for your time!!!

  3. Stack1 says:

    Hi Justin, I have a suggestion for your Waitrways book. Often, I see that students like me need to see a working example as soon as possible when they start learning something. So, I did some Google search and came up with an example that works now. Can you please consider putting something similar in the intro of your Waitrways book ? You could just give the students a this example with all the explanation and then proceed with the theory. How does that sound ?

    Thanks !

    Requirements – Ruby 2.0, Watir, Watir-webdriver

    The script below will perform the following steps:
    1. Go to google.com;
    2. In the search form, enter the text Watir;
    3. Click on search button and wait till the page is loaded;
    4. Check if we get a page with search results, by checking an expected string in search results.

    require ‘watir’
    require ‘rubygems’

    # Create instance of a browser (such as FF) for tests.
    browser = Watir::Browser.new

    # Now we are ready to test a web application – google.com.
    puts “Beginning of the test for Google search engine”

    # Open Google home page
    puts “Step 1: Go to the Google homepage”
    browser.goto “http://www.google.com”

    # Maximize browser (optional)
    #browser.send_keys :f11

    # Define a variable which will store the text to search
    search_text = “Watir”

    # Looking at the source code of the target page, try to find a way to identify the search bar
    # element.

    Notice that name=q in the above code. Soon, we will tell watir that we want to find the search bar by its name which is q. We could also use id=”gbqfq” or class=”gbqfif” instead of name. Lets take name for now.


    # Type there the text in variable
    puts ” Step 2: enter ” + search_text + ” in the search text field.”
    browser.text_field(:name, “q”).set search_text # “q” is the name of the search field

    # Similar to the step above, try to find a way to identify the search button.


    # Click on the locator of search button
    puts ” Step 3: click the ‘Google Search’ button.”
    browser.button(:name, “btnG”).click # “btnG” is the name of the Search button

    # Display the results from the search page
    puts ” Expected Result:”
    puts ” A Google page with results should be shown”

    # Check if the results on the search page are as we expect.
    expectedString = “Watir.com” # Just do a manual search on google to get such strings.
    puts ” Actual Result:”

    if browser.text.include? expectedString
    puts “Test Passed. Found the expected string: #{expectedString}.”
    puts “Test Failed! Could not find the expected string: #{expectedString}”

    # After checking, say that the script has completed and close the browser.
    puts “End of test: Google search.”

    Hope this helps !

    • Justin Ko says:

      Hi Stack1,

      I agree that adding an example to the start of the book would be useful. It is in the list of things todo, but I have not been able to decide what should be in that example or how to format it. Thanks for the ideas. I will see what I can put together.

  4. farooq says:

    Hi Justin, I am facing error while composing a mail in gmail(Both IE and Chrome):
    1.unable to place the content in subject box(facing issue in chrome in IE it works fine)
    2.unable to place the content in the body of the mail(Facing issue in both IE and Chrome)
    3.Unable to click on send button (Both IE and CHrome)

    Adding to that can u please put an example like ‘Composing a mail in Gmail using Watir for both IE and Chrome’

    • Justin Ko says:

      Hi Farooq,

      Can you share what you have tried? I did not see any obvious issues with Chrome. It would probably be faster to help debug your script then to write up a full blog post.

  5. Jing says:

    Hi Justin, thanks for your excellent work on watir. I am trying to select a value from dropdown menu. After clicking “Wiki Action”, “Delete Wiki” and “Edit Wiki” would show up. Currently I am able to click the “Wiki Action”, but unable to click “Delete Wiki”
    @browser.link(:id, “wikiActionMenuLink”).click #working
    @browser.div(:id, ‘wikiActionMenuLink_dropdown’).td(:id => “dijit_MenuItem_16_text”,:text => ‘Delete Wiki’).click #not working
    Could you give me some suggestions on how to select widgetid=”dijit_MenuItem_16 item and click it?
    The html is like below.

    • Justin Ko says:

      Hi Jing,

      Sorry, I did not notice that there was a comment pending approval. Are you still needing help with this? If so, can you post the HTML (as it seems to have been lost in the original comment)? Also what is the exception when clicking the Delete Wiki link?

  6. Jing Xie says:

    Hi Justin, thanks for the reply. Don’t worry, I found the bug. The id for Delete Wiki is dynamic and I shouldn’t use it:)

  7. Joseph Strain says:

    Justin, great threads man.. Learned so much from your post. Please keep it up,

  8. raymond says:

    Hi Justin,
    Could you help me out with watir, Im trying to create a test to upload a file on an angularjs field.
    This is the sample html initially

    Select File

    And this is what html look like if it successfully upload a file

    Select File


    Since it’s using type=’text’, I can’t use the @browser.file_field(id: ‘inputResume’).set(filename.to_s) method.


  9. raymond says:

    I can’t seem to comment the html source code as it is being stripped. Is there anyway I could contact you?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s