'Combine Selenium-Wire and Selenium-Requests

i trying to figure out how i can handle Selenium-Wire and Requests.

from seleniumrequests.request import RequestMixin
from seleniumwire import webdriver


class MyCustomWebDriver(RequestMixin, webdriver):
    pass


custom_webdriver = MyCustomWebDriver()
response = custom_webdriver.request('GET', 'https://www.google.com/')
print(response)

This getting me the Error

TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

Can someone help me out with this?

Thanx in advanced.



Solution 1:[1]

As noted by C. Peck, webdriver is a module, not a class. You need to import a specific webdriver class, like so:

from seleniumrequests.request import RequestsSessionMixin
from seleniumwire.webdriver import Chrome

class MyCustomWebDriver(Chrome,RequestsSessionMixin):
    pass

custom_webdriver = MyCustomWebDriver()
response = custom_webdriver.request('GET', 'https://www.google.com/')
print(response)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matthew Dunlap