Open FranciscoPalomares opened 2 years ago
Thanks for raising this. Which versions of Selenium and Selenium Wire are you using?
@wkeeling seleniumwire: '4.5.4' (Problem requests https://github.com/wkeeling/selenium-wire/issues/452) selenium: '4.1.0'
@wkeeling in seleniumwire\webdriver.py in Remote Class, I think this solves the problem:
if seleniumwire_options.get('auto_config', True):
capabilities = {}
try:
if kwargs.get('options'):
capabilities = kwargs.get('options').to_capabilities()
else:
capabilities = kwargs.get('desired_capabilities')
except:
pass
if capabilities is None:
capabilities = DesiredCapabilities.FIREFOX.copy()
capabilities = self._configure(capabilities, seleniumwire_options)
kwargs['desired_capabilities'] = capabilities
super().__init__(*args, **kwargs)
@FranciscoPalomares this error is happening because there is a mismatch in the type of desired capabilities that Selenium Wire is sending. You're running Chrome but Selenium Wire is sending the desired capabilities for Firefox.
I'll look at figuring out how to fix this, but in the meantime you can work around the problem by supplying the correct desired capabilities in your code:
from selenium.webdriver import DesiredCapabilities
driver = webdriver.Remote(
service_chrome.service_url,
options=option,
desired_capabilities=DesiredCapabilities.CHROME.copy() # Pass an empty Chrome desired capabilities
)
If import
from selenium import webdriver
=> works if importfrom seleniumwire import webdriver
=> not worksselenium.common.exceptions.SessionNotCreatedException: Message: session not created: No matching capabilities found