Selenium argument --window-size

Is it possible to have the ability to create a webdriver with an argument when deploying a project to a cloud service to be able to do button press interactions on any page? I mean, I want to retrieve some value from a page, but I need to press a button to retrieve it beforehand, what easy way to do it so that it doesn’t throw an error. On localhost it works, the problem is during cloud service.

from selenium.webdriver.firefox.options import Options
from selenium import webdriver
def setup_driver():
  options = Options()
  options.add_argument("--window-size=1920,1080")
  driver = webdriver.Firefox(options=options)
  return driver

If I’m understanding your situation correctly:

Selenium/webdriver opens on your server machine. When you run an app locally, your server and client are coincidentally the same machine. When you deploy to Community Cloud (it generally any cloud service), your server becomes a remote machine. Therefore, when viewing your app (client), you’ll never see the selenium/webdriver windows.

So I think you’ll need a different approach unless I’ve misunderstood the basic premise.

I am not interested in seeing selenium/webdriver windows as a background user, I want it to automatically download some value,
I want it to automatically download some value which I will later want to display in the streamlit panel.

In this case, does anyone respect another possible approach to the problem possibly a solution?

Can you describe a bit more about pressing a button to retrieve something? Are you just meaning that you want the user on the front end to trigger a web crawl from a button click? I’m not understanding how the window size is related to the button press.

Meanwhile, do you have all the dependencies set up so that selenium is working on Community Cloud for the basic case?

Maybe I am misunderstood, but the issue is the --headless argument. I want the driver to be without this argument, i.e., if I open my script locally, the given page will be shown (the problem is on the cloud service, because the server machine does not have the ability to open a specific page as it is locally. I need the bot to press a button on a previously opened specific page or pages, and then when pressed, the given text will be visible, which I then download to a variable.

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