【问题标题】:Timed out receiving message from renderer: 59,996 using Selenium and Python从渲染器接收消息超时:59,996 使用 Selenium 和 Python
【发布时间】:2021-02-08 17:37:47
【问题描述】:

我的脚本有问题。 大约 10 次后,我运行以下命令出现此错误:

Timed out receiving message from renderer: 59,996

我作为ubuntu操作系统使用

  • selenium 版本是 3.141.0
  • chrome 版本 = 88.0.4324.150
  • chromewebdriver = 88.0.4324.96 for linux 64

我该如何解决?

我不明白这个错误可能是什么

import time
import os
import datetime

from selenium import webdriver #importa libreria selenium
from selenium.webdriver.common.keys import Keys #importa funzione per centrare elemento su pagina 
from selenium.webdriver.common.action_chains import ActionChains #importa funzione per centrare elemento su pagina 
from selenium.webdriver.support.select import Select #importa funzione per selezionare elemento da menu' a discesa
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from logger import logger as l
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options

email='email'
password='password'
url='https://www.unieuro.it/online/Console-Playstation-5/PlayStation-5-pidSONPS5DISC' #url del oggetto da tenere monitorato
numerocel='cellular'

chrome_options = Options()
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("enable-automation")
#chrome_options.add_argument("--headless")
chrome_options.add_argument("--no-sandbox")
chrome_options.add_argument("--dns-prefetch-disable")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("--disable-xss-auditor")
chrome_options.add_argument("--disable-web-security")
chrome_options.add_argument('--disable-dev-shm-usage')
chrome_options.add_argument("--allow-running-insecure-content")
 
driver = webdriver.Chrome(chrome_options=chrome_options)
driver.set_page_load_timeout(60)  # Timeout 15 seconds
#driver = webdriver.Chrome('./chromedriver')  # devifinisci il nome del driver

driver.implicitly_wait(60) 
driver.maximize_window() #massimizza il browser
driver.get(url) #andare al indirizzo richiesto sul campo url
time.sleep(5) #pausa prima di eseguire il comando successivo

#verifica disponibilità
dis=None
while not dis:
    try:
        i=None
        i = datetime.datetime.now()
        print ("Data e ora corrente = %s" % i)
        dis=driver.find_element_by_css_selector('a.btn-orange-normal:nth-child(2)') #verifica se è presente il bottone aggiungi al carello
        print('in stock unieuro')
    except Exception as e:
        print('out of stock unieuro')
        time.sleep(10)
        driver.refresh()  #ricarica la pagina e riesegui il controllo
        time.sleep(30)

【问题讨论】:

  • 我按照建议尝试删除所有选项,但没有解决问题?在我看来,这是一个刷新问题,还有其他方法吗?或者可能是 while not function 不好?

标签: python selenium google-chrome selenium-chromedriver render


【解决方案1】:

此错误消息...

Timed out receiving message from renderer: 59,996

...暗示ChromeDriver 无法与 Browsing ContextChrome 浏览器 会话进行通信。

最可能的原因是你为ChromeDriver配置了太多不必要的参数


解决方案

去掉不必要的参数,重新测试如下:

import time
import os
import datetime

from selenium import webdriver #importa libreria selenium
from selenium.webdriver.common.keys import Keys #importa funzione per centrare elemento su pagina 
from selenium.webdriver.common.action_chains import ActionChains #importa funzione per centrare elemento su pagina 
from selenium.webdriver.support.select import Select #importa funzione per selezionare elemento da menu' a discesa
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.ui import WebDriverWait
from logger import logger as l
from selenium.webdriver.common.by import By
from selenium.common.exceptions import NoSuchElementException
from selenium.webdriver.chrome.options import Options

email='email'
password='password'
url='https://www.unieuro.it/online/Console-Playstation-5/PlayStation-5-pidSONPS5DISC' #url del oggetto da tenere monitorato
numerocel='cellular'

chrome_options = Options()
chrome_options.add_argument("start-maximized")
driver = webdriver.Chrome(options=chrome_options)
driver.set_page_load_timeout(60)  # Timeout 15 seconds
driver = webdriver.Chrome('path/to/chromedriver')  # devifinisci il nome del driver
driver.get(url) #andare al indirizzo richiesto sul campo url

【讨论】:

  • 我按照建议尝试删除所有选项,但没有解决问题?在我看来,这是一个刷新问题,还有其他方法吗?或者可能是 while not function 不好?
猜你喜欢
  • 2021-06-17
  • 2019-01-31
  • 2018-07-05
  • 1970-01-01
  • 2020-04-25
  • 1970-01-01
  • 2020-07-26
  • 1970-01-01
  • 2020-05-23
相关资源
最近更新 更多