Is possible to create a list of web pages and open this list with python loop script? I trying something like this but after first site fail and selenium say:
selenium.common.exceptions.WebDriverException: Message: u'Session [1e42078b-f999-4a16-9b36-0c7281c95d44] was terminated due to CLIENT_STOPPED_SESSION' ; Stacktrace:
And here is my small script
from selenium import webdriver
fox = webdriver.Remote(desired_capabilities={
"browserName": "phantomjs",
"platform": "LINUX",
})
sites = ['google.com', 'yahoo.com']
for s in sites:
adrs = "http://" + str(s)
fox.get(adrs)
snap = s.split('.')[0]
fox.save_screenshot(snap +'.png')
fox.quit()
The fox.quit()
call should not happen in the loop, it should be called after:
for s in sites:
adrs = "http://" + str(s)
fox.get(adrs)
snap = s.split('.')[0]
fox.save_screenshot(snap +'.png')
fox.quit()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.