이것은 시도한 코드입니다. 다른 stackoverflow 페이지에서 얻었지만 작동하지 않았습니다. 왜 어떤 아이디어?python 셀레늄은 요소에서 스크린 샷을 저장합니다.
chrome = webdriver.Chrome()
chrome.get('http://stackoverflow.com/')
# now that we have the preliminary stuff out of the way time to get that image :D
element = chrome.find_element_by_class_name('-img') # find part of the page you want image of
location = element.location
size = element.size
chrome.save_screenshot('screenshot.png') # saves screenshot of entire page
chrome.quit()
raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot get automation extension from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html (Session info: chrome=57.0.2987.133) (Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 10.0.10586 x86_64)
편집 :
raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: cannot get automation extension from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html (Session info: chrome=57.0.2987.133) (Driver info: chromedriver=2.25.426923 (0390b88869384d6eb0d5d09729679f934aab9eed),platform=Windows NT 10.0.10586 x86_64)
업데이트 크롬 드라이버에 대한 스크린 샷을 캡처이
그냥
element.save_screenshot("file name")
를 호출 할 수있는 방법을 제공하고있다 –