open multiple tabs using selenium
Functions
Create individual smaller functions doing a single task.
Enumerations
The enumeration for file does not make sense. line_no servers no purpose.
if __name__ block
For scripts, it is a good practice to put your executable feature inside the if __name__ == &quot;__main__&quot; clause.
A rewrite of the same code might look like:
from selenium import webdriver

FILE_NAME = &quot;google-search-terms.adoc&quot;

def search_google(browser, term: str):
    term = term.replace(' ', '+').replace('&amp;', '%26')
    browser.execute_script(f&quot;window.open('https://www.google.com/search?q={term}');&quot;)


def process_file(filename: str) -&gt; str:
    with open(filename) as fin:
        for line in fin:
            yield line.strip()


def main():
    browser = webdriver.Chrome()
    browser.get('https://google.com')
    for search_term in process_file(FILE_NAME):
        search_google(browser, search_term)


if __name__ == &quot;__main__&quot;:
    main()