Solved

Dynamically changing window titles

  • 19 April 2024
  • 4 replies
  • 106 views

Badge +1

Basically my ERP generates a document page in new tab with dynamic title. URL of this page always remain same but title changes. Initially I tried to explore if I can track page using URL instead of Title however no luck. There is no pattern in window title. I tried to put wild card in title expecting window will be captured using URL, however no luck as it was capturing any random window ignoring URL

I need to setup automation to click download button to download pdf document. So I am trying to set title of the page to fixed name by using Currently Active Window so that I can play with fixed title page. Also I need this title change so that I can close all open document windows. However, window set title is also not working. Any help will be appreciated!

 

icon

Best answer by Zaid Chougle 19 April 2024, 11:48

View original

4 replies

Userlevel 4
Badge +14

Hey,

@prashantpatil02 , the page whose title is not constant, you can use below approach.

  • Get active window title: saves the title in a string variable.
  • Set title: Use that string to set the title in that window variable.

 

Let me know whether it works or not.

 
Badge +1

Hi @Zaid Chougle , Many thanks for help.

Yes I had already tried Get Title & Set Title method.

Precisely I captured active window title, saved in variable and tried to change title of existing and even new window variable using Set Title. However, title never changes. In fact I tried to close window using new title but I am getting error stating unable to find window for specified Title.

I tried closing window variable captured through ActiveWindow method but I am getting error “Close action is not supported for the selected browser type.”

Will appreciate help on this as dynamic Title with no commonality is headache now.

Badge +1

I further observed that setting Title dynamically doesn’t help to find and close that window. It was able to find and close window only when I changed the title in properties of variable. 

How to track windows which has dynamic tabs then. Looks like I wont be able to close such tabs. Any idea?

Userlevel 2
Badge +6

Note of clarification - the Set TItle - doesn’t change the UI of a window it changes the Title property of a Window type variable so you can match the name in a UI modified window.
 

Timing is important here, is 1 second long enough, can you do a “Wait for Screen Change” before capturing window title to a string?

Dynamic tabs (in Chrome/Edge) are “Window Titles”, but operate differently. 

Reply