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

    <i id='6E2Sm'><tr id='6E2Sm'><dt id='6E2Sm'><q id='6E2Sm'><span id='6E2Sm'><b id='6E2Sm'><form id='6E2Sm'><ins id='6E2Sm'></ins><ul id='6E2Sm'></ul><sub id='6E2Sm'></sub></form><legend id='6E2Sm'></legend><bdo id='6E2Sm'><pre id='6E2Sm'><center id='6E2Sm'></center></pre></bdo></b><th id='6E2Sm'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='6E2Sm'><tfoot id='6E2Sm'></tfoot><dl id='6E2Sm'><fieldset id='6E2Sm'></fieldset></dl></div>

    <tfoot id='6E2Sm'></tfoot>

        <small id='6E2Sm'></small><noframes id='6E2Sm'>

        <legend id='6E2Sm'><style id='6E2Sm'><dir id='6E2Sm'><q id='6E2Sm'></q></dir></style></legend>
          <bdo id='6E2Sm'></bdo><ul id='6E2Sm'></ul>
      1. Python、Selenium 和 Chromedriver - 使用 find_element_by_i

        Python, Selenium and Chromedriver - endless loop using find_element_by_id causes CPU problem(Python、Selenium 和 Chromedriver - 使用 find_element_by_id 的無(wú)限循環(huán)導(dǎo)致 CPU 問(wèn)題)
        <i id='P79u6'><tr id='P79u6'><dt id='P79u6'><q id='P79u6'><span id='P79u6'><b id='P79u6'><form id='P79u6'><ins id='P79u6'></ins><ul id='P79u6'></ul><sub id='P79u6'></sub></form><legend id='P79u6'></legend><bdo id='P79u6'><pre id='P79u6'><center id='P79u6'></center></pre></bdo></b><th id='P79u6'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='P79u6'><tfoot id='P79u6'></tfoot><dl id='P79u6'><fieldset id='P79u6'></fieldset></dl></div>

          <tfoot id='P79u6'></tfoot>

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

            <bdo id='P79u6'></bdo><ul id='P79u6'></ul>

                  <tbody id='P79u6'></tbody>
                • <legend id='P79u6'><style id='P79u6'><dir id='P79u6'><q id='P79u6'></q></dir></style></legend>
                  本文介紹了Python、Selenium 和 Chromedriver - 使用 find_element_by_id 的無(wú)限循環(huán)導(dǎo)致 CPU 問(wèn)題的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

                  問(wèn)題描述

                  大家好!我已經(jīng)遇到這個(gè)問(wèn)題一個(gè)星期了,但我認(rèn)為我無(wú)法解決它,而且我也沒有看到任何基于在線文章的解決方案.希望有人可以在這里幫助我...

                  Good day to all! I've been experiencing this problem for a week now but I don't think I can solve it and I also do not see any solution based on articles online. Hopefully someone can help me here...

                  我的場(chǎng)景:我需要監(jiān)控一個(gè)頁(yè)面中 6 個(gè)不同表格的價(jià)格,這些表格幾乎每秒都在變化.一天結(jié)束時(shí),我會(huì)關(guān)閉瀏覽器(通過(guò)按 X 按鈕)并終止腳本(通過(guò)按 Control+C),然后在早上再次運(yùn)行,讓它運(yùn)行一整天.該腳本是用 python 編寫的,并使用 selenium 來(lái)讀取價(jià)格.我使用的瀏覽器是 Chrome.我的操作系統(tǒng)是 Windows 2008 R2;Selenium 版本是 3.14.1

                  My scenario: I need to monitor prices from 6 different tables in one page that changes almost every second. By end of day, I would close the browser (by pressing the X button) and terminate the script (by pressing Control+C) then run again in the morning and let it run through out the day. The script is written in python and is using selenium to read the prices. The browser I use is Chrome. My OS is Windows 2008 R2; Selenium version is 3.14.1

                  這里是部分代碼.它只是在具有 1 秒間隔的無(wú)限循環(huán)中使用 find_elements_by_id 簡(jiǎn)單地讀取表格中的價(jià)格.

                  here is partial part of the code. It is just plainly reading the prices within the tables using find_elements_by_id inside an infinite loop with 1 second interval.

                  While True:
                      close1 = float(browser.find_element_by_id('bnaBox1').find_elements_by_id('lastprc1')[0].text.encode('ascii','ignore'))
                      close2 = float(browser.find_element_by_id('bnaBox2').find_elements_by_id('lastprc2')[0].text.encode('ascii','ignore'))
                      close3 = float(browser.find_element_by_id('bnaBox3').find_elements_by_id('lastprc3')[0].text.encode('ascii','ignore'))
                      close4 = float(browser.find_element_by_id('bnaBox4').find_elements_by_id('lastprc4')[0].text.encode('ascii','ignore'))
                      close5 = float(browser.find_element_by_id('bnaBox5').find_elements_by_id('lastprc5')[0].text.encode('ascii','ignore'))
                      close6 = float(browser.find_element_by_id('bnaBox6').find_elements_by_id('lastprc6')[0].text.encode('ascii','ignore'))
                      time.sleep(1)
                  ...
                  

                  在運(yùn)行的前幾分鐘,腳本消耗的 CPU 最少(大約 20%~30%),但再過(guò)幾分鐘,消耗會(huì)慢慢上升到 100%!機(jī)器中除了腳本沒有運(yùn)行其他進(jìn)程.

                  During the first few minutes of the run, the scripts consumes minimal amount of CPU (approx 20~30 percent) but after few more minutes, consumption slowly shoots up to 100%! There is no other processes running in the machine than the script.

                  到目前為止我已經(jīng)完成了故障排除(他們都沒有解決我的問(wèn)題)

                  Troubleshooting I've done so far (they all did not solve my issue)

                  • 將我的 chrome 升級(jí)到最新版本 - v71 和 chromerdriver 2.44
                  • 將 Chrome 回滾到以前的版本(v62、v68、v69、v70)
                  • 將 Chromedriver 版本回滾到 2.42 和 2.43
                  • 清除了我的 %TEMP% 文件 -
                  • 重啟機(jī)器(多次)

                  該程序僅獲取表中的值,但我懷疑在后臺(tái)某處,當(dāng)腳本運(yùn)行時(shí),不必要的數(shù)據(jù)堆積,導(dǎo)致 CPU 達(dá)到上限.

                  The program only gets values within tables but I suspect that somewhere in the background, as the the script runs, unnecessary data is piling-up which causes the CPU to hit the ceiling.

                  希望有人能幫我找出導(dǎo)致 CPU 出現(xiàn)此問(wèn)題的原因并解決問(wèn)題.

                  Hoping that someone can help me figure out what causes this problem in the CPU and resolve the issue.

                  推薦答案

                  如果您的代碼塊沒有任何可見性,特別是 ,很難猜測(cè) 100% CPU 使用率 的確切原因WebDriver 配置.所以答案將非常基于通用指南,如下所示:

                  It would be tough to guess the exact reason of 100% CPU Usage without any visibility to your code blocks specifically the WebDriver configuration. So the answer will be pretty much based on generic guidelines as follows:

                  • 永遠(yuǎn)不要關(guān)閉瀏覽器(按 X 按鈕).總是在 tearDown(){} 方法中調(diào)用 driver.quit() 來(lái)關(guān)閉 &優(yōu)雅地銷毀 WebDriverWeb Client 實(shí)例.
                    • 您可以在 PhantomJS Web 驅(qū)動(dòng)程序留在內(nèi)存中找到詳細(xì)討論
                    • Never close the browser (by pressing the X button). Always invoke driver.quit() within tearDown(){} method to close & destroy the WebDriver and Web Client instances gracefully.
                      • You can find a detailed discussion in PhantomJS web driver stays in memory
                      • 您可以在 Selenium : 如何在不調(diào)用 driver.quit() 的情況下停止 geckodriver 進(jìn)程影響 PC 內(nèi)存?

                      幾個(gè)有用的ChromeOptions()及其用法如下:

                      A couple of useful ChromeOptions() and their usage are as follows:

                      options.addArguments("start-maximized"); // open Browser in maximized mode
                      options.addArguments("disable-infobars"); // disabling infobars
                      options.addArguments("--disable-extensions"); // disabling extensions
                      options.addArguments("--disable-gpu"); // applicable to windows os only
                      options.addArguments("--disable-dev-shm-usage"); // overcome limited resource problems
                      options.addArguments("--no-sandbox"); // Bypass OS security model
                      

                    • 使用 time.sleep(1) 形式的硬編碼睡眠是一個(gè)很大的.

                    • Using hardcoded sleeps in the form of time.sleep(1) is a big No.

                      • 您可以在 如何找到詳細(xì)討論在 python 中睡眠 webdriver 毫秒
                      • 您可以在限制chrome headless CPU中找到詳細(xì)討論和內(nèi)存使用情況
                      • ChromeDriver 升級(jí)到當(dāng)前的 ChromeDriverv2.44 級(jí)別.
                      • Chrome 版本保持在 Chrome v69-71 級(jí)別之間.(根據(jù) ChromeDriver v2.44 發(fā)行說(shuō)明)
                      • 清理你的項(xiàng)目工作區(qū)通過(guò)你的IDE重建你的項(xiàng)目只需要依賴.
                      • 如果您的基礎(chǔ) Web Client 版本太舊,請(qǐng)通過(guò) 卸載它Revo Uninstaller 并安裝最新的 GA 和發(fā)布版本的 Web Client.
                      • 進(jìn)行一次系統(tǒng)重啟.
                      • 執(zhí)行你的 @Test.
                      • Upgrade ChromeDriver to current ChromeDriver v2.44 level.
                      • Keep Chrome version between Chrome v69-71 levels. (as per ChromeDriver v2.44 release notes)
                      • Clean your Project Workspace through your IDE and Rebuild your project with required dependencies only.
                      • If your base Web Client version is too old, then uninstall it through Revo Uninstaller and install a recent GA and released version of Web Client.
                      • Take a System Reboot.
                      • Execute your @Test.
                      • (僅限 Windows 操作系統(tǒng))使用 CCleaner 在執(zhí)行 Test Suite 之前和之后清除所有操作系統(tǒng)雜務(wù)的工具.
                      • (僅限 LinuxOS)在執(zhí)行 Test Suite 之前和之后釋放和釋放 Ubuntu/Linux Mint 中未使用/緩存的內(nèi)存.
                      • (WindowsOS only) Use CCleaner tool to wipe off all the OS chores before and after the execution of your Test Suite.
                      • (LinuxOS only) Free Up and Release the Unused/Cached Memory in Ubuntu/Linux Mint before and after the execution of your Test Suite.

                      這篇關(guān)于Python、Selenium 和 Chromedriver - 使用 find_element_by_id 的無(wú)限循環(huán)導(dǎo)致 CPU 問(wèn)題的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

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

                    1. <tfoot id='rZjhM'></tfoot>

                        <i id='rZjhM'><tr id='rZjhM'><dt id='rZjhM'><q id='rZjhM'><span id='rZjhM'><b id='rZjhM'><form id='rZjhM'><ins id='rZjhM'></ins><ul id='rZjhM'></ul><sub id='rZjhM'></sub></form><legend id='rZjhM'></legend><bdo id='rZjhM'><pre id='rZjhM'><center id='rZjhM'></center></pre></bdo></b><th id='rZjhM'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='rZjhM'><tfoot id='rZjhM'></tfoot><dl id='rZjhM'><fieldset id='rZjhM'></fieldset></dl></div>

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

                          <bdo id='rZjhM'></bdo><ul id='rZjhM'></ul>
                            <tbody id='rZjhM'></tbody>
                          • 主站蜘蛛池模板: 日韩高清中文字幕 | 色婷婷综合成人av | 综合精品| 日本精品一区二区三区在线观看视频 | 国产性网| 久久久久国产精品一区 | 国产欧美一区二区三区在线看蜜臀 | 日美女逼逼 | 国精日本亚洲欧州国产中文久久 | 91黄色片免费看 | 狠狠干狠狠操 | 日日摸夜夜爽人人添av | 亚洲人精品午夜 | 亚洲精选一区二区 | 日日日色| www.日本国产| 亚洲欧美综合精品另类天天更新 | 午夜视频免费网站 | 中文字幕av在线一二三区 | 另类a v| 久久久久亚洲 | 91在线网站 | 久草网视频| 成人午夜精品一区二区三区 | v亚洲 | 久久91精品国产一区二区三区 | 亚洲36d大奶网 | 激情毛片| 成年人在线观看视频 | 国产一区二区三区四区五区加勒比 | 女同av亚洲女人天堂 | 91精品国产一区二区三区 | 午夜影院 | 亚洲精品久久久久中文字幕欢迎你 | 国产成人在线免费 | 日韩一区二区三区精品 | 日韩一区在线播放 | 亚洲精品久久久久久一区二区 | 国产精品视频免费看 | 成人深夜福利 | 久久久女女女女999久久 |