Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic Window Name in Winforms App
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
Hello,

I have this issue. I am trying to run a test on a window that changes names after every run. How can i get QTP to click on a tab on a window that's name is dynamic

Code:
SwfWindow("Dynamic name of window").SwfObject("tabStrip1").Click 275,11

ive tried
Code:
SwfWindow("regexpwndtitle:= NonDynamicPartOfName.*").SwfObject("tabStrip1").Click 275,11
- i saw this on another post but that did not work.

let me know if you need more information

Chris.
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,
could you please post the obj spy snapshot of the window.

Regards,
Ravi
Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi Chris,

First get the Window title

Code:
strTitle=SwfWindow("Dynamic name of window").GetROProperty("regexpwndtitle")

Now that u have the title, u can get the dynamic value which is changing each time. Split it. and store it in Some variable

strNewTitle=<NonDynamicPartOfName>&<Dynamic value which is changing>

'set the window title
Code:
SwfWindow("Dynamic name of window").SetTOProperty "regexpwndtitle",strNewTitle

now u can use your code.

Do let me know if it does not work.

Regards,
Ankesh
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Thanks for the reply Ankesh, The problem is that every time i run the app the object name of "SwfWindow("Dynamic name of window")" is never the same (except for the begining string which is static ex: Name: Dynamic Name) so how can i add an object to the OR if the objects name will change after i run the app again. Because i get an error that says cannot identify the object "Dynamic window Name" (of class SwfWindow) verify that this object's properties match an object currently displayed in your application
Reply
#5
Solved: 11 Years, 3 Months, 3 Weeks ago
Chris,

I guess only the name property of the object is dynamic which keeps changing. U can use regular expression for this property of the object( If not name then chk which property of the object is changing dynamically. Use regular expression for that property.)

Please refer to the attached document on how to use Regular expression for object in OR..
Attachment 1 -> Attachment 2.

I hope this would help.

Regatrds,
Ankesh


Attached Files Image(s)
       
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UFT unable to identify Java app objects consistently lester 1 2,026 07-12-2018, 08:28 PM
Last Post: Ankur
  How to automate android app Naresh 2 2,921 06-11-2015, 06:37 PM
Last Post: venkatesh9032
  UFT12-- not able to open sample app poulomi21b 2 4,268 06-25-2014, 08:26 AM
Last Post: poulomi21b
  Is it possible to call Java window and Power Builder Window in 1 Action sbkhbk 0 2,530 06-05-2014, 08:18 PM
Last Post: sbkhbk
  QTP is not recording the first step of opening Flight reservation app srinanduri 2 3,161 08-06-2013, 09:59 PM
Last Post: srinanduri

Forum Jump:


Users browsing this thread: 1 Guest(s)