Your e-Business Quality Partner eValid™ -- Automated Web Quality Solution
Browser-Based, Client-Side, Functional Testing & Validation,
Load & Performance Tuning, Page Timing, Website Analysis,
and Rich Internet Application Monitoring.

eValid -- Change the Dimensions Of a New Sub-Window
eValid Home

Problem Description
How do you use the eValid DOM manipulation commands to modify the dimensions of a new sub-window?

Background Information
This HTML anchor tag opens the specified URL in the current window:

(1) <A HREF=../URL>Title Of Page</A>   [Opens in the current window]

If the passage is modified to be written like this:

(2) <A HREF=../URL TARGET=NEW-WINDOW>Title Of Page</A>   [Opens this page in new windows named "NEW-WINDOW"]

then the page is opened with a target attribute having the value NEW-WINDOW and labeled using the TITLE property.

Solution Description
The goal of this example is to make (1) behave like (2) due to actions taken on the page from within the eValid script.

In either of the two forms above, because the tag is an <A HREF=...> the DOM for the associated element will contain the target attribute. In (1) the value of that attribute is "" [blank]; in (2) the value of that attribute is "NEW-WINDOW".

What the script does is assign a new value to the attribute in (1). It does this through this set of steps:

  1. Navigate to the page where the modification is to occur.
  2. Identify the sourceIndex of the page element that contains the <A HREF=...>, which has the the target attribute that is to be modified.
  3. Assign the new target value to the elementValue.
  4. Use the ValueSet command to place the new value in target attribute.
  5. Click on the [now modified] link to view the page in the required defined new window.

Script Explanation
Here is the script which performs the above steps.

# Recording by eValid V9 Build #309, Build Date: (Dec 08 2011) 
# Copyright 2000-2012 by Software Research, Inc. 
# Recording made on: Microsoft Windows Vista Service Pack 1 (IE 7.0.6001.18000), HostName "aruba"

ProjectID "Project"
GroupID "work"
TestID "SIZE2"

ScreenSize 1280 1024
FontSize 2

InitLink "" \
Wait 2106

# Click the link to Device #1...
IndexSet 0
IndexFindElement 0 DOWN "innerText" "Device No. 1" ""
IndexElementEvent 0 "onclick" "" "" "" NAV

# Change pop-up sub-window SIZE for link to Device #1...
Resize 1 320 480

# Change COLOR...
Wait 3000
IndexSet 0
IndexFindElement 1 DOWN "tagName" "TABLE" ""
IndexMove +1
IndexFindElement 1 DOWN "tagName" "TABLE" ""
IndexMove +1
IndexFindElement 1 DOWN "tagName" "TABLE" ""
ValueSet "#FF0080"
ValuePutElement 1 "bgColor" ""
Wait 5000
ValueSet "#FFA500"
ValuePutElement 1 "bgColor" ""
Wait 3000

# Change pop-up sub-window SIZE...
Resize 1 480 800
Wait 3000
WindowClose 1

# End of Script.

Download "size2.evs"

This method works because the browser automatically creates a standard set of element attributes for known HTML tag types and leaves their values blank if they are not specified. Not every HTML tag is treated this way. eValid's ValuePutElement will have no effect if it is asked to insert a value into an element attribute if the attribute is not already defined (eValid does not create new attributes).