Simulate Page Navigation

Does anyone know the best way to simulate a user navigating to a page in a webbrowser? I have my streamlit app running in a docker container, and tests running locally.

poetry run streamlit run Home.py --server.port=8080 --server.address=0.0.0.0

Does not trigger a run of Home.py in the container. Only when I manually navigate to http://localhost:8080/ (I have port forwarding setup) – this will trigger a run of Home.py

What are my options here?

One option is using streamlit’s AppTest framework: App testing - Streamlit Docs

Another option is to use playwright, which lets you visit and interact with a website programmatically.

Here is some example code I use to run a streamlit app and then use playwright to navigate around it. st_pages/tests/test_frontend.py at main · blackary/st_pages · GitHub