I'm new to chrome headless and I have a problem.

I want to randomly select two links from a web page on the page being viewed and open them at the same time.
Indeed my goal is to be able to have the screenshots of the three pages using Selenium with chrome headless the one currently being viewed and the other two open.
The following code already gives me the screenshots script of the current page.

 from selenium import webdriver

chrome_options = webdriver.ChromeOptions()

driver = webdriver.Chrome('/home/leonel/projet_/chromedriver')



Thank you in advance.

  • 1
    Is it multithreaded ? – SlightlyKosumi Jun 26 '19 at 20:33
  • I have my URL database and I want that after opening a page, I can have the possibility to have the screenshot of other pages in the same domain. So getting out of it Chrome headless must give me the screenshot of each page. So for one URL I have three screenshot coming out. If there are sites in JS that do not allow this, so much the better. I have several URLs and I thought there is certainly something that could allow this. – Lionel Noutegne Jun 27 '19 at 0:31
  • Selenium cannot work like this. You can have one page active and take a screenshot of it, but you cannot have a screenshot of 3 windows at the same time as selenium has only one active window at the given point. You are able to open 3 windows and then switch between them and take 3 different pictures. – Saša Zejnilović Jul 1 '19 at 8:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.