Skip to content

Injecting custom webdriver to seleniumbase - is it possible? #812

Discussion options

You must be logged in to vote

Here's a generic answer for using a custom WebDriver while still having access to all seleniumbase methods. Keep in mind that if using this technique, most command-line options will have no effect because this overrides the default get_new_driver() method, which uses the options for configuring the WebDriver browser.

from seleniumbase import BaseCase
from selenium import webdriver

class BaseTestCase(BaseCase):

    def get_new_driver(self, *args, **kwargs):
        self.driver = webdriver.Firefox()
        self._drivers_list = [self.driver]
        return self.driver

    def setUp(self):
        super(BaseTestCase, self).setUp()

    def test_custom_webdriver(self):
        self.open("h…

Replies: 3 comments 11 replies

Comment options

You must be logged in to vote
2 replies
@rafalpomocnik-payability
Comment options

@mdmintz
Comment options

Comment options

You must be logged in to vote
2 replies
@rafalpomocnik-payability
Comment options

@rafalpomocnik-payability
Comment options

Answer selected by mdmintz
Comment options

You must be logged in to vote
7 replies
@mdmintz
Comment options

@kevin-asi
Comment options

@kevin-asi
Comment options

@mdmintz
Comment options

@kevin-asi
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants