Python,使用PhantomJS的多个屏幕截图

Python,使用PhantomJS的多个屏幕截图,python,Python,预期有多个屏幕截图,但我只得到第一个。 这是我试过的代码 from selenium import webdriver client_urls = ['https://www.facebook.com/','http://www.https://stackoverflow.com'] for client_url in client_urls: driver = webdriver.PhantomJS('C:\\phantomjs-2.1.1-w

预期有多个屏幕截图,但我只得到第一个。 这是我试过的代码

    from selenium import webdriver
    client_urls = 
    ['https://www.facebook.com/','http://www.https://stackoverflow.com']
    for client_url in client_urls:
        driver = webdriver.PhantomJS('C:\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe')
        driver.get(client_url)
        print(client_url)
        screen = client_urls  
        driver.get_screenshot_as_file('C:\\Users\\xyz\\output\\b.png')
        driver.quit()'''

我注意到的第一件事是stackoverflow的地址错了

试着这样做:

driver = webdriver.PhantomJS('C:\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe')
for client_url in client_urls:
    driver.get(client_url)
    driver.get_screenshot_as_file('C:\\Users\\xyz\\output\\'+client_url+'.png')
driver.quit()

如果您想将图像合并到一个图像中,我也会查看PIL。

我注意到的第一件事是stackoverflow的地址错误

试着这样做:

driver = webdriver.PhantomJS('C:\\phantomjs-2.1.1-windows\\bin\\phantomjs.exe')
for client_url in client_urls:
    driver.get(client_url)
    driver.get_screenshot_as_file('C:\\Users\\xyz\\output\\'+client_url+'.png')
driver.quit()
如果你想把这些图像合并成一个图像,我也会研究PIL