Error when operating selenium in streamlit cloud


  1. Works well locally, but fails when deployed.
  2. A new window should appear when the run button is pressed.

Steps to reproduce

Code snippet:

import streamlit as st

with st.echo():
    from selenium import webdriver
    from import Service
    from import ChromeDriverManager

    def get_driver():
        return webdriver.Chrome(service=Service(ChromeDriverManager().install()) )
    run = st.button('run')
    if run:
        driver = get_driver()        
        driver.set_window_size(1400, 1000)

If applicable, please provide the steps we should take to reproduce the error or specified behavior.

Expected behavior:

Chrome browser must be open.

Actual behavior:

Debug info

  • Streamlit version: (1.24.0)
  • Python version: (Python 3.11.3`)
  • Using Conda? PipEnv? PyEnv? Pex?
  • OS version: mac
  • Browser version: chrome

Requirements file


Additional information

Since Streamlit has a server-client architecture, all the Python commands and logic are going to run on the machine that hosts the app as opposed to any other machine being used to view the app. So even if you did install Chrome on the host machine, your viewers would not see Chrome open for them as that would all be happening within the container on the Community Cloud servers.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.