繁体   English   中英

Python selenium 打开网站后只有一个空白页面

[英]Python selenium there is only a blank page after opening the website

so i tried using this website https://www.ebay-kleinanzeigen.de/m-benutzer-anmeldung.html but after i ran my programm it display only a white page with the website url in the search bar im using python image

from selenium import webdriver

url = "https://www.ebay-kleinanzeigen.de/m-benutzer-anmeldung.html"
page = driver.get(url)

不是很清楚为什么您的程序仅显示访问网站 url的白页,并且可能需要进一步调查。 可能是Selenium驱动的WebDriver启动浏览上下文检测


解决方案

但是,使用一些额外的experimental_options我能够正确访问该网站。

  • 代码块:

     options = Options() options.add_argument("start-maximized") options.add_experimental_option("excludeSwitches", ["enable-automation"]) options.add_experimental_option('excludeSwitches', ['enable-logging']) options.add_experimental_option('useAutomationExtension', False) options.add_argument('--disable-blink-features=AutomationControlled') s = Service('C:\\BrowserDrivers\\chromedriver.exe') driver = webdriver.Chrome(service=s, options=options) driver.get('https://www.ebay-kleinanzeigen.de/m-benutzer-anmeldung.html') time.sleep(10) # only for demonstration purpose driver.save_screenshot("ebay-kleinanzeigen.png") driver.quit()
  • 保存的截图:

易趣克莱恩泽根

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM