2017-05-08 165 views
2

當我使用selenium抓取'twitter.com'時,我無法阻止自動播放的視頻剪輯。如何阻止視頻剪輯以減少在chromedriver中的內存負擔。如何在chromedriver中阻止視頻

這裏的代碼

chromeOptions = webdriver.ChromeOptions() 
prefs = {"profile.managed_default_content_settings.images" : 2} 
chromeOptions.add_experimental_option("prefs",prefs) 
browser = webdriver.Chrome(executable_path = 
'C:/Users/aa/Downloads/chromedriver/chromedriver.exe', 
chrome_options=chromeOptions) 

回答

1

在Twitter網站下面進入「情景模式和設置」,並在內容設置取消選中Video autoplay複選框。如果需要,您可以在Selenium的幫助下自動完成。