Category Archives: watir-webdriver

How to automate check for youtube video subtitle

Reading Time: 1 minute

TL;DR

In this post I will explain how I implemented check that youtube video contains specific language subtitle.

As part of application acceptance test, I needed to implement UI check that confirms that selected youtube video contains selected subtitle language. Getting the value of youtube video available subtitles from youtube player would be hard (even not manageable) task. So I decided to use different approach.

I remembered that while “search videos by subtitle language” feature was developed, developers mentioned (in github issue conversation) that this feature will be based on youtube api. So why not use this same code in my automated check?

The risk is here that we are using api that could return different list of available subtitles than one that are obtained using youtube UI elements. But knowing that Google is very good at testing their product features, I labeled that risk as very low.

youtube video subtitles
youtube video subtitles

Here is cucumber step definition:

It is important to state that I found on this blog post how to get attribute value using watir-webdriver.

Always use your tools wisely. Do not force one way of achieving something if there is more elegant way.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

How to automate heavy Javascript application?

Reading Time: 1 minute

TL;DR

Ember and Angular are examples of powerful web frameworks written in Javascript. Today, many modern websites are moving from traditional server side templates page generation and adapt those frameworks. How that affects browser automatization?

In asynchronous world, before any interaction with page element, it is good practice to wait for that element to become visible.

Here are watir webdriver waiting methods, and page object waiting methods. And in “heavy javascript application”, when I wait for element to become visible, I got exception

Watir::Exception::UnknownObjectException

The main issue here is that when you do some action, let’s say button click, javascript framework manipulates DOM tree. Your element was present in DOM tree before the action, but after the action was removed and you got UnknownObjectException.

Watir webdriver also has present wait methods, but that does not cover UnknownObjectException.

So, in order to tackle this problem, you need to write your UnknownObjectException handler, something like this:

Watir::Wait.until(load_timeout){
  begin     
    loading_layout_element.visible?
  rescue Watir::Exception::UnknownObjectException
    false
  end
}

 

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather

Tweeting with Firefox is different than tweeting with Chrome

Reading Time: 1 minute

TL;DR

In this post I will explain how simple change in testing environment influenced my testing of simple feature.

Feature is rather simple, tweet something interesting from the application. As this feature is tested, I was creating automated script for it. This feature is important for my client, so I decided that it should be part of regression testing suite.

I developed script for Chrome, and I also decided to check it using Firefox. Remember that in RIMGEA we learned that G stands for Generalize. We need to test our feature by changing the environment, in this case browser itself.

And in Firefox script failed! Why? Because Firefox tweet feature has one extra step in domain of twitter application.

 

firefox_tweet_3

 

It is clear that Firefox requires one extra button click. Since prior to that click, user clicks on “Log in and tweet” button, this is not consistent with that button. User expects that with one click he does two actions, log in to twitter and tweet that item.

chrome_tweet_2

 

 

With this post I amplified on real case how important is to vary your testing environment because in that way you could find interesting issues within the application.

 

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather