1

I'm currently writinng a script to interact with a live stream, mainly taking screenshots.

I'm using Selenium Webdriver for Python to open Chromedriver and go from there.

However, I want to build this behavior into a bigger program and hide the whole process of opening chromedriver, waiting for the stream to load and then taking a screenshot, so the user only gets the screenshot once it's done.

From what I've found online, it's not possible to hide the command-line console within my script with something like setVisible and I'm okay with the console showing up, but I really have to hide the website popup, so the screenshot will be taken in the background.

Is it possible to do so in Python/Selenium or do I have to switch to another language?

1
  • 1
    So you want a "headless" test?
    – jonrsharpe
    Jun 16, 2016 at 11:53

2 Answers 2

4

You can use a headless browser like htmlunit to run your tests without a browser popup: https://github.com/SeleniumHQ/htmlunit-driver

1
  • Didn't know it's called a headless browser, thanks for the link
    – Hillburn
    Jun 16, 2016 at 14:42
0

You need to create a script with vb or python which will close the popups on the basis of their titles.

Even you can minimise them also. Code in vb Set wshShell = CreateObject("WScript.Shell")

Do ret = wshShell.AppActivate("title of the popup") If ret = True Then wshShell.SendKeys "%N" Exit Do End If WScript.Sleep 500 Loop

5
  • Minimizing isn't what I'm looking for, I need the window to be completely invisible. Also, doesn't closing the popups imply that I can't work with them anymore? I still need to take screenshots with the invisible browser windows.
    – Hillburn
    Jun 16, 2016 at 14:54
  • Please correct if i got you wrong But htmlunit driver is headless means there would not be a UI so you would not get screenshot. Jun 16, 2016 at 14:58
  • Guess I shouldn't call it a screenshot, but I do need a picture of a website's content without showing the website on the screen.
    – Hillburn
    Jun 16, 2016 at 15:15
  • Yes you can get the content for sure with headless driver Jun 16, 2016 at 15:16
  • @Hillburn You cannot take any picture of the website's content using a headless browser as obbiously the browser will be headless, it won't render the content, there will be no content to take a picture of.
    – Mobrockers
    Jun 17, 2016 at 7:15

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.