Using DP to define windows - Printable Version +- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums) +-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP) +--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming) +--- Thread: Using DP to define windows (/Thread-Using-DP-to-define-windows) |
Using DP to define windows - mrerek - 07-15-2011 I am new only 4 weeks into QTP. I have scripts that only use a 2 items in a repository. They are: Code: Window("Windows Internet Explorer").WinObject("Internet Explorer_Server").Type "This is a test" The Window & WinObject objects. I use these so that I can insert randowm strings into ajax grids, copy them and do STRCompare. I would like to use the Description.Create method I have used for all other objects I get ROProperties on. However What I have written fails. Code: Set IEwindow = Nothing Every other object that I have to identify in the script uses this approach and works correctly. Am I a dummy or is there something I have failed to see? Suggestions welcomed mrerek RE: Using DP to define windows - rajpes - 07-15-2011 assignment to variable after its usage?? shouldn't it be, Code: ObjWindow = Window(IEwindow).GetROProperty("regexpwndclass") by the way your web addin doenst seem to be loaded, it should show "browser" instead of window in my opinion RE: Using DP to define windows - mrerek - 07-16-2011 Thank you rajpes for your reply. I think I need to clarify further. I use the followong code to define and set The Browser and Page Objects for my test as the first few lines for my test. Code: ' Browser Description ==================== If I move the last 2 lines ABOVE the Browser and Page Descriptions QTP displays an "unknown" error stepping thru the begining of the script. If I leave the 2 lines where BELOW the descriptions [as written above] the 2 variables are correctly identified and everything in the scripts runs fine. I use a single object repository that contains 2 objects [ Windows Internet Explorer & Internet Explorer_Server ] I captured using a low level recording. This enables me to type random strings I generate into ajax grids on the page. This all works fine for 10 actions in the test. What I am attempting to do is remove my dependence on the small repository that I am using to type random strings. I wish to make the code transportable through a rather large set of modules within the application. My initial thought was that if I followed what I have been using successfully I could do the same for these other two objects. Hence I came up with the code I originally posted. I do have my web add-in loaded. Does this clarify things - suggestion[s]? Thank you - mrerek RE: Using DP to define windows - rajpes - 07-16-2011 How will that generate random strings? what logic do you think qtp will use to generate random string? RE: Using DP to define windows - mrerek - 07-18-2011 More clarification is needed... This is what I use to create the randoms strings... Code: Const LETTERS = "abcdefgh ijklmnopqrstuvwxyz ABCDEFGH IJKLMNOPQRSTUVWXYZ 0123456 789 ~!#$%^*()_+-=/?,<.>" So I utilize the Code: Window("Windows Internet Explorer").WinObject("Internet Explorer_Server").Type to type in the str The RowCount & MaxCharCount are calculated elsewhere My intention is to use Descriptive Programming to create the Window("Windows Internet Explorer").WinObject("Internet Explorer_Server") objects so I can use them to type in my strings but NOT have to have them in a repository. These are the only 2 objects I have in a repository and I would like to not have to rely on them to make the code in the script[s] truly transportable through multiple modules in the app I am testing. Does this clarify things? I am open to suggestions. Thanks, rajpes RE: Using DP to define windows - rajpes - 07-19-2011 Code: ObjBrw("name").Value = BrwHandle As long as i know name,title,regexpwndclass property values will stay unique for a page.If so, you can make descriptive programming directly as Code: browser("title:=titile_property_shown_in_object_spy").page("title:=titile_property_shown_in_object_spy"").Sync It doesnt seem like browser and page objects are identified by your qtp , make sure web add-in is loaded! RE: Using DP to define windows - mrerek - 07-21-2011 I have come up with the following strategy using SendKeys. Code: Dim [b]str[/b]= "" However QTP tells me that I have passed a bad parameter to SendKeys. I am looking for a suggestion to pass the variable str to SendKeys 20 times to populate a cell grid with 1200 characters. Thanks - mrerek |