Testing file_uploader with seleniumbase

I am trying to test my app using selenium. To do so, I need selenium to upload a file from my computer using the file_uploader widget. Hereโ€™s the code for my app and the test module

app.py

import streamlit as st

filename = st.file_uploader('Upload file here')

test_app.py

from seleniumbase import BaseCase
import time

class ComponentsTest(BaseCase):
    def test_basic(self):

        self.open("http://localhost:8501")
        time.sleep(5)
        self.find_element('section.css-po3vlj.exg6vvm15').send_keys(path_to_file_on_computer)

However, when I run my test module, I get a pop up asking if I want to clear the streamlit cache.

1 Like

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