问题
I'm trying, and failing, to open the website https://www.bet365.com
with selenium and python. In my code, I've followed these steps.
First, I just did
from selenium import webdriver
browser=webdriver.Chrome()
browser.get('https://www.bet365.com')
After a while, Bet365 changed something and doing the above returned a gray screen. In order to bypass that, I did the following
from selenium import webdriver
options = webdriver.ChromeOptions()
options.add_argument("window-size=1920,1080")
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
browser=webdriver.Chrome(options=options,executable_path=r"chromedriver.exe")
browser.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {
"source": """
Object.defineProperty(navigator, 'webdriver', {
get: () => undefined
})
"""
})
browser.execute_cdp_cmd('Network.setUserAgentOverride',
{"userAgent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4240.198 Safari/537.36'})
browser.get('https://www.bet365.com')
Since last saturday, doing this, or even the first script, returns the out of memory screen. As this is the first attempt, and it happens as well if I erase cookies and cache and restart the computer, I'm led to believe the problem is not in my computer, which loads other pages just as fine, not Chrome, which loads Bet365 in a regular browser just fine as well, but with Bet365 and selenium.
How can I solve this?
EDIT Someone thought this thread answered my question Chrome driver for Selenium stuck in grey screen on bet365 site
Although I appreciate the effort, the gray screen was a problem I have already solved, as I put in my question. The Out of memory error is the one I want to fix.
回答1:
After a few days of research, I saw that when I changed cdc_ to xyz_ I was successful in opening the Bet365 website.
Solution: I opened the file chromedriver.exe with Notepad ++ and searched and replaced "cdc_" with "xyz_" and saved the file.
There, he opened the page normally.
来源:https://stackoverflow.com/questions/65071572/out-of-memory-error-in-pythonselenium-first-load