0

Using the top answer in this question to create new driver objects for each window using selenium (i.e. create a new variable name for a new webdriver object for each window). How can I name the new variable after a dictionary value through indexing a dictionary?

Here's a list of dictionaries:

individual_window_array = [{"window_numeric_name/driver_object_name":f'{window_numeric_name}'}, {"window_description":f'{current_window_description}'}
                                       ,{"window_tabs":f'{current_window_tabs}'}, {"window_custom_title":f'{current_window_title}'}]

How do I dynamically name the new driver objects (corresponding to each window) after a value of a dictionary indexed like this:

    new_window = next(iter(individual_window_array[0].values()))

double_wizz
  • 79
  • 10
  • I think the browsers already have this built-in. (restore your last browsing session? prompt) Selenium seems like the wrong tool for this job. A browser extension/plugin might be more practical. – pcalkins Dec 28 '21 at 21:49
  • @pcalkins What I am trying to do is much more detailed than what the browser offers. Browsers don't offer the possibility to write a description or give sessions titles. This is also part of an overarching project and the data will be later used for more functionality. I know selenium wasn't built for this but I am experimenting with it. I think the problem now is more a python problem rather than a selenium problem as I have already found a way to retrieve all the info I need from selenium. – double_wizz Dec 29 '21 at 06:19

0 Answers0