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()))

2
  • 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. Commented Dec 28, 2021 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. Commented Dec 29, 2021 at 6:19

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.