![]() ![]() Your current approach with execute_script is bound to be faster as we are simply injecting Java Scripts to open new TAB s with URL s. Your previous approach with send_keys(Keys.COMMAND + 't') is bound to consume more time as we switch_to.window() and get("") too. So we already have have 2 approaches at out disposal to open New TAB with Selenium. Also, since the processes are started right after creation, the overhead of creating a process also has to be calculated in the time difference you see. from multiprocessing import Processĭepending on how many CPUs you have, the load of the machine, the timing of many things happening in the computer will have an influence on the time the threads/process start. You can use threading or multiprocessing to speed up the process. Upgrade the chromedriver(>2.25)/chrome browser(>55.0) on your MAC to remove the empty data tab. I start with 6 now, but I want to load 100 tabs.Īlso, how do I get rid of my first weird looking tab? ![]() I used to have this # -*- coding: utf-8 -*-įrom import Keysĭriver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')ĭriver.switch_to.window(driver.window_handles) Is what I have right now is the fastest way? I want to create a python script to open up a lot tabs import osĭriver =webdriver.Chrome('/usr/local/bin/chromedriver')ĭriver.execute_script("window.open('') ") ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
March 2023
Categories |