Contributions
Help with VBscript - Time Related
Hello, (Thank you in advance!) I am having trouble with a VBscript that I'm writing. I am automating a testcase and the scenario calls for me to change my regional settings mid way through the test. What I believe is happening is that my regional settings are not getting reset correctly. Let me explain in sudo code: 'To start I set regional settings to English SetRegionalSettings("English (United States)") at this point I grab the system time using Now( ) ' **Point of failure on second run** I expect this to be in English MM/DD/YYYY HH:MM:SS AM/PM 'I then do some things in my script and change regional settings SetRegionalSettings("English (United Kingdom)") 'I do some more things and then at the end of the test I set it back to English SetRegionalSettings("English (United States)") The problem I'm facing is that after running this script a number of times I've noticed that my time format is not getting restored to English properly. So lets say I've ran the script once and everything is fine, I then run it again. If you note the point above where it fails, what i'm seeing is that Now () is returning MM/DD/YYYY MilitaryTime. Via a google search I found this link which explains that the Now() function uses the regional settings which the user has, so why isn't it returning the correct time? Link Mentioned: http://support.microsoft.com/kb/218964 Additional Info: Code used to switch Regional Settings: '-------------------------------------------- 'Subroutine: SetRegionalSettings 'Purpose: This Subroutine will set your computers regional settings to whatever ' you want them to be. 'Inputs: Region of you choice, must be a string which is identical to the choice ' in the drop down. Ex: "English (United Kingdom)" Or ' "English (United States)" 'Output: N/A '-------------------------------------------- Sub SetRegionalSettings(Region) 'Open regional settings Set sa = CreateObject("Shell.Application") sa.ControlPanelItem("Intl.cpl") aqUtils.Delay(3000) 'Set value and save Call Aliases.rundll321.dlgRegionalAndLanguageOptions.page32770.ComboBox.ClickItem(Region) aqUtils.Delay(100) Call Aliases.rundll321.dlgRegionalAndLanguageOptions.page32770.Keys("[Tab]") aqUtils.Delay(500) Aliases.rundll321.dlgRegionalAndLanguageOptions.Window("Button", "OK", 1).ClickButton aqUtils.Delay(3000) End Sub17KViews0likes2Comments- 1.3KViews0likes0Comments
Re: Changing Objects
Agreed, the problem is that at a later time, after I have recorded and the name mapping has occurred, the script breaks down on playback because TestComplete is now looking for the raw object again for some odd reason. Take my newest example: In my code I use the value "Aliases.ws32.frm_PortfolioQuickView.fraNotificationsDisplay.chkStatus_3" this is the name mapped value. Later on I run the script and it breaks down because it can't find "Aliases.ws32.frm_PortfolioQuickView.fraNotificationsDisplay.chkStatus_3" it is now looking for "Aliases.ws32.frm_PortfolioQuickView.VBObject("fraNotificationsDisplay").VBObject("chkStatus_3")" At this point in time if I do a new recording of the object, Test Complete will begin working acuratly again because it now knows the object as "Aliases.ws32.frm_PortfolioQuickView.fraNotificationsDisplay.chkStatus_3" again. Does that make sense? Quick steps: 1. I record and get namemapped value 2. Use in my script 3. (at a later time)During playback Test complete looks for the Raw value 4. I record second time 5. Test Complete works again.1.3KViews0likes0CommentsRe: Changing Objects
OK, so I don’t think that fixed it, I just experienced the same thing: Before recording: Aliases.ws32.frm_PortfolioQuickView.VBObject("fraNotificationsDisplay").VBObject("chkStatus_3") After recording: Call Aliases.ws32.frm_PortfolioQuickView.fraNotificationsDisplay.chkStatus_31.3KViews0likes0CommentsRe: Changing Objects
I think that article is going in a different direction than what I'm describing. IN that persons case the problem is a dynamically created object and the solution is to generalize the name mapping value so that it no longer looks at the new ID each time the browser is launched. In my case the object i'm viewing should remain static, it is part of a client application. I am investigating the following option to see if it might be the culprit. Ideas? Engines > General > Object Naming > Use short names when possible Thanks again!1.3KViews0likes0CommentsRe: Changing Objects
P.S. I have confirmed that this is directly related to recording. In the above example, I recorded the object in question and then spy'd on it the third time, it went back to what it was orgionally. I'm looking through Test Completes options now but I haven't found anything that seems that it would impact this.1.3KViews0likes0CommentsChanging Objects
Hello all, I have been facing an issue in my automated scripts using TestComplete and I'm curious if anyone else has experienced this. What will happen is that I spy on an object and record the object (see below), write my script and then at some point in the future when I run my test it fails. At this point I spy on the object again and it has changed. I know this sounds bizarre but I have had this happen to me more than 10 times now. See my example below and note that the two objects are the same, just written differently: First Time I spy'ed: Aliases.ws32.frm_All.lst_UnderlyingPortfolios.lst.lst Second Time I spy'ed: Aliases.ws32.VBObject("frm_All").VBObject("lst_UnderlyingPortfolios").VBObject("lst").VBObject("lst") Any thoughts on configuration within Test Complete that could correct this? Please note that these two session were against the same software build so there is no chance that the object actually changed. The issue seems to be within TestComplete and how it's viewing objects. Is it possible that if you have recorded the object in your current session that Test complete will use a different version than if you did not(reaching for some logical answer). If so, how can I stabilize this so that I always see the same object? TestComplete Program Version: 7.52.678.7 Microsoft XP Pro Service Pack 3 Thank you in advance! -J17KViews0likes8Comments- 1.3KViews0likes0Comments