[FEATURE]: Use a WebDriver that's not Selenium
Opened this issue · 4 comments
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.)
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.
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!
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.
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.