Category Archives: selenium

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

Run Chrome with extension on SauceLabs

Reading Time: 1 minute

TLDR

In this post I will explain how to run chrome with extension on SauceLabs.

For one of my client I need to create webdriver automation scripts for web application that is javascript heavy. In order to identify html elements, I am using testability ids! chrome extension. We are also using SauceLabs in order to be able to test web application on chrome/windows7 combination.

Here is technology stack: cucumber->page-objects->watir-webdriver->webdriver->ruby

Heavy googling did not helped immediately because of this issue. Scroll to Ruby example. Can you spot the documentation UI issue? I also used git history feature to get important information. In the end I was able to see code example by looking at page source.

Here is the gist:

So, without the exploratory testing of ruby ChromeDriver documentation I would not be able to create automation script.

Facebooktwittergoogle_plusredditpinterestlinkedinmailby feather