RapidTech1898
RapidTech1898•3mo ago

Change headless mode?

Hello - i am currently running the actor locally in VSCode in python - How and where can i change if the Actor is running headless or not with this "Actor.config.headless" parameter Where can i change this to False for example?
3 Replies
MEE6
MEE6•3mo ago
@RapidTech1898 just advanced to level 2! Thanks for your contributions! 🎉
Real1ty
Real1ty•3mo ago
Hi there! The headless option is tied to the APIFY_HEADLESS variable (set to "1" or "0"). 1 = headless 0 = headful You have two ways to turn off headless mode: Set the environment variable before running your actor:
# Unix/macOS
export APIFY_HEADLESS=0
python my_actor.py
# Unix/macOS
export APIFY_HEADLESS=0
python my_actor.py
Override the configuration in code, as long as you do it before any browser is launched:
from apify import Configuration

# Disable headless mode at runtime
Configuration.get_global_configuration().headless = False
from apify import Configuration

# Disable headless mode at runtime
Configuration.get_global_configuration().headless = False
Hope this helps!
RapidTech1898
RapidTech1898OP•2mo ago
Hello - thanks for the response - I tried it with this: Configuration.get_global_configuration().headless = False print(Actor.config.headless) But the result is still: (apify) C:\DEVNEU\Python-Diverses\Apify_Development\leadSearch>apify run -p Run: "C:\DEVNEU.venv\apify\Scripts\python.exe" -m src True

Did you find this page helpful?