首页 > 解决方案 > 如何在网站上使用 Selenium python?现在被网站屏蔽了

问题描述

我尝试制作一个脚本女巫来解析网站 bet365.com。但是这个网站是块硒,页面打不开。我有一个代码:

options = Options()
ua = UserAgent()
userAgent = ua.random
options.add_experimental_option("excludeSwitches", ["enable-automation"])
options.add_experimental_option('useAutomationExtension', False)
options.add_experimental_option("detach", True)
options.add_argument('--no-sandbox')
options.add_argument(f'user-agent={userAgent}')
driver = webdriver.Chrome(chrome_options=options)
driver.get('https://www.bet365.com/')

它不起作用。有人可以帮忙吗?

它只是打开浏览器,什么也不做。对于其他网站,这是正确的,这是屏幕截图[1]:https ://i.stack.imgur.com/wc5pd.png

标签: pythonseleniumselenium-webdriver

解决方案


推荐阅读