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

[FEATURE]: Use a WebDriver that's not Selenium #250

Open
2 tasks done
imoldfella opened this issue Jan 24, 2023 · 4 comments
Open
2 tasks done

[FEATURE]: Use a WebDriver that's not Selenium #250

imoldfella opened this issue Jan 24, 2023 · 4 comments
Labels
enhancement New feature or request

Comments

@imoldfella
Copy link

Description

I have written a WebDriver on top of Playwright, and I'd like to use it with Boa including the functionality in the Selenium folder.

Alternatives

For my proof of concept I copied the boa code into my tree and used the OpenQA.Selenium namespace to get Boa to make it use my code instead Selenium WebDrivers. I would like to put this code into its own namespace and have the Boa nuget package be able to work with it.

Anything else?

I can work on this, but I'd like a clear picture what would need to happen to get it merged.

Commitments

  • I agree to follow Boa Constrictor's Code of Conduct.
  • I want to work on this issue myself. (This is voluntary, not required.)
@imoldfella imoldfella added the enhancement New feature or request label Jan 24, 2023
@imoldfella
Copy link
Author

One simple PR would be to copy the Selenium folder to a WebDriver folder and replace WebDriver with PlaywrightDriver. That's a lot of duplicated code, but it could be merged over time. Maybe not the most elegant approach though. One problem area with a more elegant approach is the widely used "By" class with all its static functions; this is not an interface that I can substitute easily. Spamming generics everywhere would be a possibility, but doesn't really help code readability.

My approach to Actions is very different; Selenium Actions uses lists of fairly deeply nested interfaces (targets old versions of .net) and serializes the actions for their wire protocol. For my purposes (no wire) I make a list of lambdas and send them to another thread (the thread is to bridge sync webdriver api to async playwright api). I don't see this having any immediate impact, but potentially the code bases could profitably diverge if you wanted to take advantage of some playwright differences in the Playwright folder.

@AutomationPanda
Copy link
Contributor

Hi @imoldfella ! The Boa Constrictor team and I have actually discussed making an adapter like this, where we would write a library interactions that use the same interfaces as the WebDriver interactions but use Playwright underneath.

We are going to meet again at the end of this week. We'll add this to our agenda for discussion. Thanks!

@imoldfella
Copy link
Author

imoldfella commented Jan 24, 2023

I ended up taking all my code out of the OpenQA.Selenium namespace in favor of the copy/paste approach. I currently use the packaged ScreenPlay and a lightly modified Selenium.Boa.Constrictor package (just changed using references) This way I can run both side by side and compare results. It would have have been a great application for SML functors, but copy/paste always works. I'll be interested to find out how you decide to proceed.

@imoldfella
Copy link
Author

Anybody that's interested can find a package here to kick the tires https://www.nuget.org/packages/Datagrove.BoaPlaywright/1.0.0-beta-3. I'm sure it has a long way to go to get upstreamed but we are using it every day. @SwampFire512

Anyone that's using Cucumber with Boa can also find a Cucumber transpiler that we use with it that is top down async (this lets you swap out sync selenium calls for async playwright calls if you are so inclined). Also we found that transpilation provides a better debug experience. https://www.nuget.org/packages/Pepin.

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

No branches or pull requests

2 participants