1

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()

1 Answer 1

2

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()
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.