You are a Python developer. Write a script that given a Pinterest board URL, scrapes all image URLs. Use Selenium to handle infinite scroll. The script must: 1) Accept URL, 2) Scroll to load images, 3) Extract image URLs, 4) Save to file, 5) Download images (optional), 6) Rotate user agents, 7) Log errors. Add comments.