久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<legend id='0xsny'><style id='0xsny'><dir id='0xsny'><q id='0xsny'></q></dir></style></legend>

        <bdo id='0xsny'></bdo><ul id='0xsny'></ul>

      <small id='0xsny'></small><noframes id='0xsny'>

    1. <i id='0xsny'><tr id='0xsny'><dt id='0xsny'><q id='0xsny'><span id='0xsny'><b id='0xsny'><form id='0xsny'><ins id='0xsny'></ins><ul id='0xsny'></ul><sub id='0xsny'></sub></form><legend id='0xsny'></legend><bdo id='0xsny'><pre id='0xsny'><center id='0xsny'></center></pre></bdo></b><th id='0xsny'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='0xsny'><tfoot id='0xsny'></tfoot><dl id='0xsny'><fieldset id='0xsny'></fieldset></dl></div>
      1. <tfoot id='0xsny'></tfoot>
      2. 通過 Selenium - Python 在新選項卡中打開網址的最快

        What is the fastest way to open urls in new tabs via Selenium - Python?(通過 Selenium - Python 在新選項卡中打開網址的最快方法是什么?)
        <tfoot id='FFK1A'></tfoot>
      3. <i id='FFK1A'><tr id='FFK1A'><dt id='FFK1A'><q id='FFK1A'><span id='FFK1A'><b id='FFK1A'><form id='FFK1A'><ins id='FFK1A'></ins><ul id='FFK1A'></ul><sub id='FFK1A'></sub></form><legend id='FFK1A'></legend><bdo id='FFK1A'><pre id='FFK1A'><center id='FFK1A'></center></pre></bdo></b><th id='FFK1A'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='FFK1A'><tfoot id='FFK1A'></tfoot><dl id='FFK1A'><fieldset id='FFK1A'></fieldset></dl></div>

          1. <small id='FFK1A'></small><noframes id='FFK1A'>

                <tbody id='FFK1A'></tbody>
              • <bdo id='FFK1A'></bdo><ul id='FFK1A'></ul>

                  <legend id='FFK1A'><style id='FFK1A'><dir id='FFK1A'><q id='FFK1A'></q></dir></style></legend>
                • 本文介紹了通過 Selenium - Python 在新選項卡中打開網址的最快方法是什么?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我想創建一個python腳本來打開很多標簽

                  I want to create a python script to open up a lot tabs

                  import os
                  import selenium
                  from selenium import webdriver
                  
                  
                  driver =webdriver.Chrome('/usr/local/bin/chromedriver')
                  driver.execute_script("window.open('http://www.msn.com');")
                  driver.execute_script("window.open('http://www.cnn.com');")
                  driver.execute_script("window.open('http://www.yahoo.com');")
                  driver.execute_script("window.open('https://www.apple.com');")
                  driver.execute_script("window.open('https://www.google.com');")
                  driver.execute_script("window.open('https://www.stackoverflow.com');")
                  
                  # driver.quit()
                  

                  當我跑步時,我得到了

                  我現在擁有的是最快的方法嗎?

                  Is what I have right now is the fastest way?

                  我曾經有過這個

                  # -*- coding: utf-8 -*-
                  
                  import os
                  import selenium
                  from selenium import webdriver
                  from selenium.webdriver.common.keys import Keys
                  
                  driver =webdriver.Chrome('/usr/local/bin/chromedriver')
                  
                  #1
                  driver.get("http://msn.com")
                  
                  #2
                  driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')
                  driver.switch_to.window(driver.window_handles[-1])
                  driver.get("http://cnn.com")
                  
                  #3
                  driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')
                  driver.switch_to.window(driver.window_handles[-1])
                  driver.get("http://www.yahoo.com")
                  
                  #4
                  driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')
                  driver.switch_to.window(driver.window_handles[-1])
                  driver.get("https://www.apple.com")
                  
                  #5
                  driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')
                  driver.switch_to.window(driver.window_handles[-1])
                  driver.get("https://www.google.com")
                  
                  #6
                  driver.find_element_by_tag_name('body').send_keys(Keys.COMMAND + 't')
                  driver.switch_to.window(driver.window_handles[-1])
                  driver.get("https://www.stackoverflow.com")
                  

                  它可以工作,但它很痛苦.

                  It works but it is painfully slow.

                  我現在從 6 個開始,但我想加載 100 個標簽.

                  I start with 6 now, but I want to load 100 tabs.

                  另外,我如何擺脫我的第一個奇怪的標簽?我什至確定它為什么在那里.

                  Also, how do I get rid of my first weird looking tab? I am even sure why it is there.

                  推薦答案

                  升級你MAC上的chromedriver(>2.25)/chrome瀏覽器(>55.0),去掉空數據;標簽.您可以使用 threadingmultiprocessing 來加快處理速度.

                  Upgrade the chromedriver(>2.25)/chrome browser(>55.0) on your MAC to remove the empty data; tab. You can use threading or multiprocessing to speed up the process.

                  from multiprocessing import Process
                  import os
                  import selenium
                  from selenium import webdriver
                  from selenium.webdriver.common.keys import Keys
                  
                  driver =webdriver.Chrome('/usr/local/bin/chromedriver')
                  driver.get("http://msn.com")
                  def func1():
                    print 'launching: MSN'
                   driver.execute_script("window.open('http://www.msn.com');")
                  
                  def func2():
                    print 'launching: CNN'
                    driver.execute_script("window.open('http://www.cnn.com');")
                  
                  if __name__ == '__main__':
                    p1 = Process(target=func1)
                    p1.start()
                    p2 = Process(target=func2)
                    p2.start()
                    p1.join()
                    p2.join()
                  
                  def runInParallel(*fns):
                    proc = []
                    for fn in fns:
                      p = Process(target=fn)
                      p.start()
                      proc.append(p)
                    for p in proc:
                      p.join()
                  
                  runInParallel(func1, func2)
                  

                  取決于你有多少 CPU、機器的負載、計算機中發生的許多事情的時間都會影響線程/進程的啟動時間.此外,由于進程在創建后立即啟動,因此創建進程的開銷也必須以您看到的時間差來計算.

                  Depending 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. 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.

                  這篇關于通過 Selenium - Python 在新選項卡中打開網址的最快方法是什么?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  How to make a discord bot that gives roles in Python?(如何制作一個在 Python 中提供角色的不和諧機器人?)
                  Discord bot isn#39;t responding to commands(Discord 機器人沒有響應命令)
                  Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“關于我嗎?Discord 機器人的功能?(不和諧.py))
                  message.channel.id Discord PY(message.channel.id Discord PY)
                  How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 機器人?)
                  discord.py - Automaticaly Change an Role Color(discord.py - 自動更改角色顏色)

                    <legend id='TF09o'><style id='TF09o'><dir id='TF09o'><q id='TF09o'></q></dir></style></legend>
                      <tbody id='TF09o'></tbody>
                      • <bdo id='TF09o'></bdo><ul id='TF09o'></ul>

                            <small id='TF09o'></small><noframes id='TF09o'>

                            <i id='TF09o'><tr id='TF09o'><dt id='TF09o'><q id='TF09o'><span id='TF09o'><b id='TF09o'><form id='TF09o'><ins id='TF09o'></ins><ul id='TF09o'></ul><sub id='TF09o'></sub></form><legend id='TF09o'></legend><bdo id='TF09o'><pre id='TF09o'><center id='TF09o'></center></pre></bdo></b><th id='TF09o'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='TF09o'><tfoot id='TF09o'></tfoot><dl id='TF09o'><fieldset id='TF09o'></fieldset></dl></div>
                            <tfoot id='TF09o'></tfoot>
                            主站蜘蛛池模板: 国产一区二区三区在线免费观看 | 中文字幕亚洲视频 | 亚卅毛片 | 欧美国产中文字幕 | 激情影院久久 | 日本精品一区二区 | 国产性网 | av在线免费观看不卡 | 中文字幕一区二区三区四区五区 | 久久久久中文字幕 | 久久亚洲一区二区三区四区 | 欧美a级成人淫片免费看 | 久久免费视频1 | 国产精品入口麻豆www | 成人在线视频免费看 | 成人在线一区二区三区 | 国产精品成人一区 | 亚洲精品久久久久久首妖 | aaa在线| 精品久久久av | 理论片87福利理论电影 | 日日操av | 国产99视频精品免视看9 | 国产精品免费一区二区 | 激情在线视频网站 | 台湾佬久久 | 国产精品久久久久久久久久久新郎 | 国产区视频在线观看 | 亚洲一区二区在线 | 亚洲欧美激情精品一区二区 | 一区二区三区四区国产 | 中文字幕在线观看日韩 | 欧美一区二区三区久久精品视 | 日韩成人 | 久久久91精品国产一区二区精品 | 亚洲成人一区二区三区 | 伊人精品在线视频 | 欧美日本韩国一区二区三区 | 日本又色又爽又黄的大片 | 午夜三级网站 | 天天操夜夜艹 |