seleniumbase / SeleniumBase

📊 Python's all-in-one framework for web crawling, scraping, testing, and reporting. Supports pytest. UC Mode provides stealth. Includes many tools.
https://seleniumbase.io
MIT License
5.16k stars 960 forks source link

try to pass ChromeDriverManager, with error #2719

Closed guocity closed 5 months ago

guocity commented 5 months ago

from webdriver_manager.chrome import ChromeDriverManager from selenium.webdriver.chrome.service import Service from selenium.webdriver.chrome.options import Options

chrome_options = Options() chrome_options.add_experimental_option("debuggerAddress", "localhost:9222") webdriver_service = Service(ChromeDriverManager().install())


TypeError Traceback (most recent call last) Cell In[2], line 4 1 from seleniumbase import BaseCase ----> 4 sb = BaseCase(driver) 5 sb.open("https://wikipedia.org/")

File /opt/homebrew/lib/python3.11/site-packages/seleniumbase/fixtures/base_case.py:104, in BaseCase.init(self, *args, kwargs) 103 def init(self, *args, *kwargs): --> 104 super().init(args, kwargs) 105 self.__initialize_variables()

File /opt/homebrew/Cellar/python@3.11/3.11.9/Frameworks/Python.framework/Versions/3.11/lib/python3.11/unittest/case.py:402, in TestCase.init(self, methodName) 400 self._testMethodDoc = 'No test' 401 try: --> 402 testMethod = getattr(self, methodName) 403 except AttributeError: 404 if methodName != 'runTest': 405 # we allow instantiation with no explicit method name 406 # but not an incorrect or missing method name

TypeError: attribute name must be string, not 'Chrome'

mdmintz commented 5 months ago

SeleniumBase doesn't use ChromeDriverManager. It has it's own driver manager. It also looks like you're trying to import the raw Selenium Service and Options directly, which is not the correct way to use SeleniumBase.

See SeleniumBase/help_docs/syntax_formats.md to learn the valid ways of structuring SeleniumBase tests based on the 23 Syntax Formats that are available.