Webload Scripting Guide
Total Page:16
File Type:pdf, Size:1020Kb
Scripting Guide Version 12.0 The software supplied with this document is the property of RadView Software and is furnished under a licensing agreement. Neither the software nor this document may be copied or transferred by any means, electronic or mechanical, except as provided in the licensing agreement. The information in this document is subject to change without prior notice and does not represent a commitment by RadView Software or its representatives. WebLOAD Scripting Guide © Copyright 2018 by RadView Software. All rights reserved. November, 2018, RadView Publication Number WL-PRO-0909-SCG84 WebLOAD, TestTalk, Authoring Tools, ADL, AppletLoad, and WebExam, are trademarks or registered trademarks of RadView Software IBM, and OS/2 are trademarks of International Business Machines Corporation. Microsoft Windows, Microsoft Windows 95, Microsoft Windows NT, Microsoft Word for Windows, Microsoft Internet Explorer, Microsoft Excel for Windows, Microsoft Access for Windows and Microsoft Access Runtime are trademarks or registered trademarks of Microsoft Corporation. SPIDERSESSION is a trademark of NetDynamics. UNIX is a registered trademark of AT&T Bell Laboratories. Solaris, Java and Java-based marks are registered trademarks of Sun Microsystems, Inc. HP-UX is a registered trademark of Hewlett-Packard. SPARC is a registered trademark of SPARC International, Inc. Netscape Navigator and LiveConnect are registered trademarks of Netscape Communications Corporation. Any other trademark name appearing in this book is used for editorial purposes only and to the benefit of the trademark owner with no intention of infringing upon that trademark. For product assistance or information, contact: Toll free in the US: 1-888-RadView Fax: +1-908-864-8099 World Wide Web: www.RadView.com North American Headquarters: International Headquarters: RadView Software Inc. RadView Software Ltd. 991 Highway 22 West, Suite 200 13 Haamal Street, Park Afek Bridgewater, NJ 08807 Rosh Haayin, 4809249, Israel Email: [email protected] Email: [email protected] Phone: 908-526-7756 Phone: +972-3-915-7060 Fax: 908-864-8099 Fax: +972-3-915-7011 Toll Free: 1-888-RadView Table of Contents Chapter 1. Introduction ..................................................................................................... 1 WebLOAD Documentation ............................................................................................................. 1 Typographical Conventions ............................................................................................................ 2 Where to Get More Information ..................................................................................................... 3 Online Help .................................................................................................................................. 3 Technical Support Website ......................................................................................................... 4 Technical Support ........................................................................................................................ 4 Chapter 2. Programming your JavaScript script ........................................................... 5 Understanding JavaScript scripts ................................................................................................... 5 What are JavaScript scripts? ....................................................................................................... 5 Script Tree Structure .................................................................................................................... 7 script Program Structure ............................................................................................................ 8 script Execution Sequence ........................................................................................................ 11 Editing the JavaScript Code in a script ................................................................................... 15 Adding JavaScript Object Nodes .................................................................................................. 19 File Management ............................................................................................................................ 21 Including Files ............................................................................................................................ 21 Copying Files .............................................................................................................................. 25 Output Files ................................................................................................................................ 27 Security ............................................................................................................................................. 30 Authentication ............................................................................................................................ 30 Secure Data Transmission through SSL.................................................................................. 32 Error Management ......................................................................................................................... 35 Error Management Tools .......................................................................................................... 35 Non-Standard script Execution Sequence .............................................................................. 39 Rules of Scope for Local and Global Variables ........................................................................... 43 Limited Context ......................................................................................................................... 44 Local Context .............................................................................................................................. 45 Global Context ........................................................................................................................... 47 Search Order Precedence .......................................................................................................... 56 Global Sharing Considerations ................................................................................................ 57 Identification Variables and Functions ........................................................................................ 57 WebLOAD Scripting Guide i ClientNum .................................................................................................................................. 59 RoundNum ................................................................................................................................. 59 Example: identifying a client and round ................................................................................ 61 GeneratorName() ....................................................................................................................... 61 GetOperatingSystem() .............................................................................................................. 62 VCUniqueID() ............................................................................................................................ 62 Chapter 3. Advanced JavaScript script Features ........................................................ 63 Working with the XML DOM ....................................................................................................... 63 WebLOAD XML DOM Objects................................................................................................ 65 Data Islands ................................................................................................................................ 65 Example: Using Data Islands in a script ................................................................................. 69 Creating and Filling New XML DOM Objects ...................................................................... 79 Example: Building an XML Database from Scratch .............................................................. 83 Handling Web Service Transactions ....................................................................................... 84 Document Type Definition (DTD)........................................................................................... 86 Working with Java .......................................................................................................................... 87 Requirements ............................................................................................................................. 88 Identifying Java Objects in JavaScript scripts ........................................................................ 90 Forestalling Errors ..................................................................................................................... 91 Example: passing simple variables between Java and JavaScript ....................................... 93 Passing Objects Between Java and JavaScript........................................................................ 94 Automatic Timers And Counters For Java Objects ............................................................... 96 Calling a WebLOAD API from a Java Application ............................................................... 98 Working with Java Selenium Scripts ........................................................................................