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 -- Illustration of User Agent String Modification
eValid Home

Main Idea: The SetUserAgent command lets eValid "pretend" to be any browser you wish it to be, and this feature can be used to validate server behavior that involves alternative responses based on browser type (including, as the example shows, denial of support to specific browsers).

Summary
This page illustrates how to manipulate the eValid browser's user agent string to some of the various known "Agents" and pretends to be other browsers. This can either be done within a playback script, or it can be done with the -AGENT command line switch.

A key resource on the web for this illustration is the www.useragentstring.com website, which returns detailed information about the user agent string that is reported by your browser [whatever one you're using].

Script Behavior Described
Here is a step by step description of how this script works.

  1. This page has a link to Google and a link to CNN. Tests will be done in sub-windows launched from this starting page:

  2. Phase I: Confirm operation with the eValid default browser settings (which will be IE7). We begin by navigating to the Google DOCS page:

  3. Check operation with eValid's natural User Agent String (UAS) by logging into Google Docs:

  4. Login is successful, so the application accepts eValid's UAS:

  5. Now, log out of the application.

  6. We navigate to www.useragentstring.com to confirm the UAS value. Now, we confirm that we have been using the IE 7 browser (which eValid emulates):

  7. Phase II: See what happens with eValid spoofing being an Opera browser?

    From the starting page we show the script line that sets the UAS as Opera:

  8. We try to sign on as before:

  9. We get a message from Google saying that our browser is not a supported browser for this application:

  10. We navigate to www.useragentstring.com to confirm the UAS value. As expected it is [as we set it] Opera:

  11. Phase III: Now we set the UAS to a new value, one that will be acceptable like Firefox:

  12. Log in as before, and we see that we have access to our data:

  13. Log out normally:

  14. We navigate to www.useragentstring.com to confirm the UAS value. We confirm that eValid is emulating Firefox 2.0.0.8, as we told it to:

  15. Now log out normally:

  16. We have a "yellow screen" [some WARNINGs], but that's OK:

  17. Here is the event log passage that confirms that the Set User Agent command succeeded in setting eValid to appear as Opera:

  18. Here is the event log passage that confirms that the Set User Agent command succeeded in setting eValid to appear as Firefox:

eValid Script Used
Here is the script used to produce the eValid playback above:

ProjectID "TestScriptLanguage"
GroupID "PlaybackOriented"
TestID "2-user-agent"
LogID "DEFAULT"

ScreenSize 1280 1024
FontSize 2
DeleteCache
DeleteCookies


# Defaulted IE compatible browser on Startup...
InitLink "http://www.e-Valid.com/Products/Documentation.9/UserAgent/agentpage.html"
Wait 3223
FollowLink 0 41 "docs.google.com" "http://docs.google.com/" ""
SubFrameSet 1 "Welcome to Google Docs"
#Wait 17535
SyncOnText 1 "Password"
InputValue 1 93 "TEXT" "Email" "Email" "evalid" "" ""
Wait 1468
InputValue 1 101 "TEXT" "Passwd" "Passwd" "XXXXXXXXXX" "" ""
InputValue 1 107 "CHECKBOX" "PersistentCookie" "PersistentCookie" "yes" "" \
	"FALSE" ""
Wait 1592
SubmitClick 1 114 "" "signIn" "Sign in" ""
Wait 5509
FollowLink 1 66 "Sign out" "http://docs.google.com/logout?hl=en_US" ""
Wait 1448
GotoLink 1 "http://www.useragentstring.com/" ""
Wait 5227
WindowClose 1

# Change to the OPERA browser for the next navigations, known to be INCOMPATIBLE...
Wait 1159
SetUserAgent "Opera/8.51 (Windows NT 5.1; U; en)"
Wait 2663
FollowLink 0 41 "docs.google.com" "http://docs.google.com/" ""
SubFrameSet 2 "Welcome to Google Docs"
SyncOnText 2 "Password"
InputValue 2 93 "TEXT" "Email" "Email" "evalid" "" ""
Wait 1468
InputValue 2 101 "TEXT" "Passwd" "Passwd" "XXXXXXXXXX" "" ""
InputValue 2 107 "CHECKBOX" "PersistentCookie" "PersistentCookie" "yes" "" \
	"FALSE" ""
Wait 1592
SubmitClick 2 114 "" "signIn" "Sign in" ""
Wait 3448
GotoLink 2 "http://www.useragentstring.com/" ""
Wait 5227
ValidateSelectedText 2 31 0 "Opera" ""
#ValidateSelectedText 2 0 "Opera" ""
WindowClose 2

# Change to the FIREFOX browser for further navigations, known to be COMPATIBLE...
Wait 1183
SetUserAgent "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; " \
	"rv:1.8.1.8) Gecko/20201008 Firefox/2.0.0.8"
Wait 2663
FollowLink 0 41 "docs.google.com" "http://docs.google.com/" ""
SubFrameSet 3 "Google Docs"
SyncOnText 3 "evalid@gmail.com"
Wait 4509
FollowLink 3 66 "Sign out" "http://docs.google.com/logout?hl=en_US" ""
Wait 1448
GotoLink 3 "http://www.useragentstring.com/" ""
ValidateSelectedText 3 31 0 "Firefox" ""
Wait 5227
WindowClose 3

# End of script.