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

Support for custom driver initialization and webdriver manager #291

Open
dAnjou opened this issue Mar 28, 2022 · 8 comments
Open

Support for custom driver initialization and webdriver manager #291

dAnjou opened this issue Mar 28, 2022 · 8 comments

Comments

@dAnjou
Copy link

dAnjou commented Mar 28, 2022

Hi,

I've only looked at the source code so far, and it seems cumbersome to programmatically initialize a custom driver, it's not documented at least.

And it'd be nice if https://github.com/SergeyPirogov/webdriver_manager was supported.

Thanks!

@BeyondEvil
Copy link
Contributor

Would you mind giving an example of that? What problem are you trying to solve?

As for webdriver_manager, without digging deeper into it - I think it's out of scope for this plugin. You should be able to add that to whatever test-framework you're using.

@dAnjou
Copy link
Author

dAnjou commented Mar 29, 2022

As for webdriver_manager, without digging deeper into it - I think it's out of scope for this plugin.

That's fair. I was just mentioning it because it's a very convenient and apparently also very popular way of getting a driver instance. Considering that, it'd be nice to support initialization of a driver programmatically.

Currently, at least according to the docs, it's only possible to specify a driver via CLI flag, and there are browsers missing that one might wanna use, like, Brave or Chromium.

@BeyondEvil
Copy link
Contributor

Currently, at least according to the docs, it's only possible to specify a driver via CLI flag, and there are browsers missing that one might wanna use, like, Brave or Chromium.

I see, so would you like to see a generic CLI option of specifying a browser? Would you help me understand what that would look like? I ask, because we basically only wrap the browser configuration from the underlying Selenium. So unless I misunderstand (which is 100% possible), that functionality would have to be supported by them first.

Out of curiosity, are there drivers for Brave and Chromium?

@BeyondEvil
Copy link
Contributor

Out of curiosity, are there drivers for Brave and Chromium?

Ah, brave == chromium, https://abodeqa.com/selenium-tests-in-brave-browser/

@dAnjou
Copy link
Author

dAnjou commented Apr 3, 2022

I see, so would you like to see a generic CLI option of specifying a browser?

I barely ever use CLI flags with pytest, just my preference, I rather configure my test environment in code or settings. So in this case, I'd rather be able to overwrite a fixture.

I've had a look at the code and I'm not sure whether I'd get away with overwriting the driver fixture because there are things happening in there which might have implications that I don't understand yet.

@notamonad
Copy link

notamonad commented Jun 30, 2022

With regards to supporting webdriver_manager I think the biggest use case is to be able to let users run tests against different browsers without having to install them manually (i.e making sure they are present on the host system)

Looking at the code I think it may be possible to override driver_args fixture to be able to supply custom service object for arguments of the driver class? But then user has to write additional logic for initializing service class themselves based on passed arguments through --driver. Also the fact that driver_args is currently returning None makes me think it may change in future releases?

Right now it seems that only chrome driver supports driver_args argument, so there is seemingly no way to pass your custom service objects along to WebDriver instance?

@BeyondEvil
Copy link
Contributor

With regards to supporting webdriver_manager I think the biggest use case is to be able to let users run tests against different browsers without having to install them manually (i.e making sure they are present on the host system)

Looking at the code I think it may be possible to override driver_args fixture to be able to supply custom service object for arguments of the driver class? But then user has to write additional logic for initializing service class themselves based on passed arguments through --driver. Also the fact that driver_args is currently returning None makes me think it may change in future releases?

Right now it seems that only chrome driver supports driver_args argument, so there is seemingly no way to pass your custom service objects along to WebDriver instance?

As soon as the re-write of pytest-html is finished, we're planning to take look at pytest-selenium.

Mainly to make sure it fully supports Selenium 4.0, but also if we can add or at least easily support extensions like this.

@gtisan
Copy link

gtisan commented Nov 16, 2022

As there Selenium 4.0 is now supported, are there any chances to get also support for webdriver_manager ?

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

4 participants