Selenium automation with execution of custom site specific javascript

21 Feb

Expanding on my previous post: Javascript is your ally for Selenium / WebDriver

I am wondering if anyone has used WebDriver’s javascript execution facility to execute custom javascript code (not general code used for browser/Selenium limitation workarounds) but javascript code that’s specific to their website or web application under test.

I asked a colleague within our organization and he said his department recommends avoiding such use. While I understand that it is best not to dig into specific detailed functionality of the app under test for UI automation it does have some uses:

Limitations of the UI and element locators (IDs, class names, name attributes or other DOM attributes, visual text on screen) in providing a good way to define locators in an object oriented way programmatic parameterized way so that your locators are more dynamic and not static. For example have a method that selects a color and we “select/click” the element (finding it) based on color name rather than some less user friendly/understandable strategy. In some cases, that’s not possible, but might be if you execute app-specific javascript code to find out the info you want that is not exposed via the UI. Same goes for checking application state that might not be fully exposed visually in the UI. I’ve found it helpful in my case.

The other useful case may be for more white box javascript API & unit testing integrated within Selenium UI tests for extended test coverage. This might be useful compared to issues that may come up with pure javascript API/unit tests alone per this blog: http://watirmelon.com/2013/02/09/why-i-dont-like-jasmine/.

What are your thoughts on this?

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Seek Nuance

Python, technology, Seattle, careers, life, et cetera...

TELLURIUM

New Era of Test Automation

Der Flounder

Seldom updated, occasionally insightful.

The 4T - Trail, Tram, Trolley, Train

Exploring Portland with the 4T

Midnight Musings

Thoughts on making art

Automation Guide

The More You Learn The More You Play...!

The Performance Engineer

Code.Test.Tune.Optimize.

humblesoftwaredev

Thoughts related to software development

Yi Wang's Tech Notes

A blog ported from http://cxwangyi.blogspot.com

Appium Tutorial

Technical…..Practical…..Theoretically Interesting

LinuxMeerkat

I swear! Meerkats can do Linux

PacketsDropped

Requeuing the packets dropped in my memory.

Two cents of software value

Writing. Training. Consulting.

@akumar overflow

wisdom exceeding 140 chars.

Lazy Programmer's Shortcut

Java, J2EE, Spring, OOAD, DDD & LIFE! .......all in one :)

Testing Mobile Apps

www.SoftwareTestingStudio.com

%d bloggers like this: