Video: Build a Web Automation Framework in under 20 min

In under 20min you can actually have a web automation framework built and running a simple test.  I did a screencast video of this, and put it up on Youtube:

I realize my voice isn’t the greatest, but hey, we all have our faults.

 

Video: Build a Web Automation Framework in under 20 min
User Rating: 4.8 (2 votes)
  • Hi Brian,
    I have read most of your articles regarding Ruby scripting and a great fan of you as well. I need your help to resolve my problem I am using Ruby and WATIR for automating one of the test website. All i do is enter customer details (Name, DOB, Address, etc) and submit the details. Then a Final decision page appears with a unique reference number (10 digit length). My ruby script works fine until submitting the details but i am unable to fetch that 10 digit unique reference number in my script, can you help me plz?

    When i inspect UI element, i see:
    9904018475517819

  • Admin

    Hi, yes that is an interesting case. If there is no identifier for tag that renders the 16digit number, you could use watir to capture the text on the page, store it as a variable and then regex the variable contents for the 16 digit number… for example:
    require ‘watir-webdriver’
    require ‘watir-webdriver-performance’

    @browser = Watir::Browser.new :chrome
    @browser.goto “http://donsbikeshop.com/”
    bodytext = @browser.text
    p bodytext

    That will print the contents of the page to your console.

    Now if you had some output like “example text alsdkf 9904018475517819 asdfjjasdf sf” as the output of “bodytext” you could then match for that 16 digit number using some regex like:
    mtch = bodytext.match(/d{16}/) # This looks for 16 sequential digits in the value of bodytext and stores it to mtch
    p mtch.to_s # printing to console the string of what was found in the above statement

    As long as the digits are html in page, this will work. if it’s an image, you’ll need some screen scraping solution.

    • Thanks Brian. I ran the command, “bodytext” does give the contents of the page but “mtch” returns “” (nil), not sure why though we have a 16 digit number on the screen. I have emailed the details of what is displayed in “bodytext”. Thanks for your help.