Skip to content
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

Remote webdriver doesn't work #143

Closed
squiddy opened this issue Feb 10, 2020 · 4 comments
Closed

Remote webdriver doesn't work #143

squiddy opened this issue Feb 10, 2020 · 4 comments

Comments

@squiddy
Copy link

squiddy commented Feb 10, 2020

Running tests with the remote webdriver doesn't work in the current release of pytest-splinter.

Steps to reproduce

$ cat test_foo.py
def test_something(browser):
    browser.visit('https://google.com')
$ pip install pytest_splinter
$ pytest --splinter-webdriver remote

Error

env/lib/python3.6/site-packages/pytest_splinter/plugin.py:536: in prepare_browser
    browser = browser_pool[browser_key] = get_browser(splinter_webdriver)
env/lib/python3.6/site-packages/pytest_splinter/plugin.py:521: in get_browser
    return get_browser(splinter_webdriver, retry_count - 1)
env/lib/python3.6/site-packages/pytest_splinter/plugin.py:521: in get_browser
    return get_browser(splinter_webdriver, retry_count - 1)
env/lib/python3.6/site-packages/pytest_splinter/plugin.py:517: in get_browser
    wait_time=splinter_wait_time, **kwargs
env/lib/python3.6/site-packages/pytest_splinter/plugin.py:72: in Browser
    browser = splinter.Browser(*args, **kwargs)
env/lib/python3.6/site-packages/splinter/browser.py:90: in Browser
    return get_driver(driver, *args, **kwargs)
env/lib/python3.6/site-packages/splinter/browser.py:64: in get_driver
    return driver(*args, **kwargs)
env/lib/python3.6/site-packages/splinter/driver/webdriver/remote.py:47: in __init__
    self.driver = Remote(command_executor, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'WebDriver' object has no attribute 'session_id'",) raised in repr()] WebDriver object at 0x7f763c53d588>, args = ('http://127.0.0.1:4444/wd/hub',)
kwargs = {'desired_capabilities': {'acceptInsecureCerts': True, 'browserName': 'firefox', 'marionette': True}, 'firefox_profile...AAAAdXNlci5qc1BLAQIUAxQAAAAIAESqdk0AAAAAAgAAAAAAAAAHAAAAAAAAAAAAAACkgbMGAAAubWFya2VyUEsFBgAAAAACAAIAagAAANoGAAAAAA=='}}

    def __init__(self, *args, **kwargs):
        """Set keep_alive to True."""
        kwargs['keep_alive'] = True
>       return old_init(self, *args, **kwargs)
E       TypeError: __init__() got an unexpected keyword argument 'firefox_profile'

env/lib/python3.6/site-packages/pytest_splinter/webdriver_patches.py:34: TypeError

Relevant(?) package versions

pytest==5.3.5
pytest-splinter==2.0.1
selenium==3.141.0
splinter==0.13.0
@squiddy
Copy link
Author

squiddy commented Feb 10, 2020

Current workaround:

@pytest.fixture(scope='session')
def splinter_browser_class(request):
    from pytest_splinter.plugin import Browser

    def FixedBrowser(driver_name, *args, **kwargs):
        if driver_name == "remote":
            kwargs.pop('firefox_profile')
            kwargs.pop('moz:firefoxOptions')
        return Browser(driver_name, *args, **kwargs)

    return FixedBrowser

From what I understand, selenium/splinter at some point deprecated the firefox_profile (amongst other) argument and replaced it with options.

@bubenkoff
Copy link
Member

can you please submit PR with the fix?

@mpasternak
Copy link
Contributor

@squiddy is the problem still persisting?

@mpasternak
Copy link
Contributor

mpasternak commented Aug 8, 2022

I have checked command pytest --splinter-webdriver remote on my codebase and for Selenium tests it looks like webdriver_patches.py is being run without any exceptions. Closing. @squiddy thank you for this problem report and if the problem still exists please comment and I will reopen. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants