Skip to content

Selenium Base does not work on a stock ubuntu droplet instance #3423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zackees opened this issue Jan 15, 2025 · 1 comment
Closed

Selenium Base does not work on a stock ubuntu droplet instance #3423

zackees opened this issue Jan 15, 2025 · 1 comment
Labels
duplicate The answer/solution already exists somewhere external Outside SeleniumBase's scope. / Ask somewhere else.

Comments

@zackees
Copy link

zackees commented Jan 15, 2025

Ubuntu 24.10
Image: s-2vcpu-4gb, but any will probably work with enough ram

Install:

apt install -y python3 python3-pip
pip install uv --break-system-packages
uv venv
uv pip install seleniumbase

Then I paste this script in

from seleniumbase import BaseCase
BaseCase.main(__name__, __file__)  # Call pytest

class MyTestClass(BaseCase):
    def test_swag_labs(self):
        self.open("https://www.saucedemo.com")
        self.type("#user-name", "standard_user")
        self.type("#password", "secret_sauce\n")
        self.assert_element("div.inventory_list")
        self.click('button[name*="backpack"]')
        self.click("#shopping_cart_container a")
        self.assert_text("Backpack", "div.cart_item")
        self.click("button#checkout")
        self.type("input#first-name", "SeleniumBase")
        self.type("input#last-name", "Automation")
        self.type("input#postal-code", "77123")
        self.click("input#continue")
        self.click("button#finish")
        self.assert_text("Thank you for your order!")

This is the output I get back:

============================================ {  File "<stdin>:1:SB} starts =============================================

Warning: chromedriver not found. Getting it now:

*** chromedriver to download = 132.0.6834.83 (Latest Stable) 

Downloading chromedriver-linux64.zip from:
https://storage.googleapis.com/chrome-for-testing-public/132.0.6834.83/linux64/chromedriver-linux64.zip ...
Download Complete!

Extracting ['chromedriver'] from chromedriver-linux64.zip ...
Unzip Complete!

The file [chromedriver] was saved to:
/root/.venv/lib/python3.12/site-packages/seleniumbase/drivers/
chromedriver

Making [chromedriver 132.0.6834.83] executable ...
[chromedriver 132.0.6834.83] is now ready for use!

Traceback (most recent call last):
  File "/root/.venv/lib/python3.12/site-packages/seleniumbase/core/browser_launcher.py", line 5223, in get_local_driver
    driver = webdriver.Chrome(options=chrome_options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 241, in __init__
    self.start_session(capabilities)
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 329, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 384, in execute
    self.error_handler.check_response(response)
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 232, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
Stacktrace:
#0 0x65018ac177ca <unknown>
#1 0x65018a70f2f0 <unknown>
#2 0x65018a746063 <unknown>
#3 0x65018a7428c6 <unknown>
#4 0x65018a78fbc9 <unknown>
#5 0x65018a78f216 <unknown>
#6 0x65018a783753 <unknown>
#7 0x65018a750baa <unknown>
#8 0x65018a751dfe <unknown>
#9 0x65018abe238b <unknown>
#10 0x65018abe6307 <unknown>
#11 0x65018abcee7c <unknown>
#12 0x65018abe6ec7 <unknown>
#13 0x65018abb324f <unknown>
#14 0x65018ac062f8 <unknown>
#15 0x65018ac064c0 <unknown>
#16 0x65018ac16646 <unknown>
#17 0x76778b6a1e2e <unknown>
#18 0x76778b733a4c <unknown>


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/root/.venv/lib/python3.12/site-packages/seleniumbase/plugins/sb_manager.py", line 1214, in SB
    sb.setUp()
  File "/root/.venv/lib/python3.12/site-packages/seleniumbase/fixtures/base_case.py", line 15191, in setUp
    self.driver = self.get_new_driver(
                  ^^^^^^^^^^^^^^^^^^^^
  File "/root/.venv/lib/python3.12/site-packages/seleniumbase/fixtures/base_case.py", line 4183, in get_new_driver
    new_driver = browser_launcher.get_driver(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.venv/lib/python3.12/site-packages/seleniumbase/core/browser_launcher.py", line 2845, in get_driver
    return get_local_driver(
           ^^^^^^^^^^^^^^^^^
  File "/root/.venv/lib/python3.12/site-packages/seleniumbase/core/browser_launcher.py", line 5304, in get_local_driver
    driver = webdriver.Chrome(
             ^^^^^^^^^^^^^^^^^
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
    super().__init__(command_executor=executor, options=options)
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 241, in __init__
    self.start_session(capabilities)
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 329, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 384, in execute
    self.error_handler.check_response(response)
  File "/root/.venv/lib/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 232, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: probably user data directory is already in use, please specify a unique value for --user-data-dir argument, or don't use --user-data-dir
Stacktrace:
#0 0x60e74374c7ca <unknown>
#1 0x60e7432442f0 <unknown>
#2 0x60e74327b063 <unknown>
#3 0x60e7432778c6 <unknown>
#4 0x60e7432c4bc9 <unknown>
#5 0x60e7432c4216 <unknown>
#6 0x60e7432b8753 <unknown>
#7 0x60e743285baa <unknown>
#8 0x60e743286dfe <unknown>
#9 0x60e74371738b <unknown>
#10 0x60e74371b307 <unknown>
#11 0x60e743703e7c <unknown>
#12 0x60e74371bec7 <unknown>
#13 0x60e7436e824f <unknown>
#14 0x60e74373b2f8 <unknown>
#15 0x60e74373b4c0 <unknown>
#16 0x60e74374b646 <unknown>
#17 0x71c0ae6a1e2e <unknown>
#18 0x71c0ae733a4c <unknown>

Most likely this can be fixed with a helpful error message. It's on a worker machine and remote debugging isn't easy.

Can anyone help me figure out a work around? I'm guessing it's probably the binary failing to start. Process failure message seems to be swallowed up.

Devs, can you insert a warning with whatever subprocess.run was streaming?

@mdmintz mdmintz added duplicate The answer/solution already exists somewhere external Outside SeleniumBase's scope. / Ask somewhere else. labels Jan 15, 2025
@mdmintz
Copy link
Member

mdmintz commented Jan 15, 2025

Looks like a duplicate of SeleniumHQ/selenium#14609 for your custom Ubuntu instance.
Regular Ubuntu Linux is working fine for me, eg:
https://github.com/seleniumbase/SeleniumBase/actions/runs/12779997552).
For your custom "stock ubuntu droplet instance", there's nothing I can do from my end unless there's a change on the https://github.com/SeleniumHQ/selenium side.

@mdmintz mdmintz closed this as completed Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate The answer/solution already exists somewhere external Outside SeleniumBase's scope. / Ask somewhere else.
Projects
None yet
Development

No branches or pull requests

2 participants