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.
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.