britka / playwrightium

Run Selenium or Selenide tests with Playwright Java
Apache License 2.0
55 stars 4 forks source link

Discovered issues #95

Open hazyone opened 3 weeks ago

hazyone commented 3 weeks ago

While trying to connect Playwrightium as an alternative Selenide backend, faced with some issues.

Remote constructor should use tracing option too (somewhere in, at this moment it is not mapped). https://github.com/britka/playwrightium/blob/899d3ffeb3e1b4dd02c6ee8e39d36b81a93488ae/src/main/java/org/brit/driver/PlaywrightiumDriver.java#L158

You should be ready for unexpected behavior and catch PlaywrightException on any page/context api calls. I had unexpected close fails, because Selenide tried gracefully close page that is crashed or something like this. https://github.com/britka/playwrightium/blob/899d3ffeb3e1b4dd02c6ee8e39d36b81a93488ae/src/main/java/org/brit/driver/PlaywrightiumDriver.java#L330

==== You should check, that this is non-empty string, or this charseq not consists of any "control" symbols. In other way, you will try to fill non-input field with "Escape" and this will cause PW error. https://github.com/britka/playwrightium/blob/899d3ffeb3e1b4dd02c6ee8e39d36b81a93488ae/src/main/java/org/brit/element/PlaywrightWebElement.java#L91

Not safe, can cause exception. Also, if href is not presented, you should return null to have valid href checks in Selenide side. https://github.com/britka/playwrightium/blob/899d3ffeb3e1b4dd02c6ee8e39d36b81a93488ae/src/main/java/org/brit/element/PlaywrightWebElement.java#L109

Not sure, why are you trying to do getAtrribute again, but this is not safe too. In case of attributes with delimiters (aria-*, for example), you will get an error here, because you can't reference node attribute this way if it has delimiter. https://github.com/britka/playwrightium/blob/899d3ffeb3e1b4dd02c6ee8e39d36b81a93488ae/src/main/java/org/brit/element/PlaywrightWebElement.java#L112

You should add check, that element type attribute is: type.equals("radio") || type.equals("checkbox"), in other case, you will face an error from PW, when Selenide will try to Describe you input element. https://github.com/britka/playwrightium/blob/899d3ffeb3e1b4dd02c6ee8e39d36b81a93488ae/src/main/java/org/brit/element/PlaywrightWebElement.java#L119

And also exists Selenide check is broken, while connecting this library, so every exists check should be refactored to visible or anything else

I liked your approach, hope my finds will help you. But we will move forward, even after these fixes it is very unstable to use Selenide with alternative backend, because of lot of hacks on their side :)

britka commented 3 weeks ago

@hazyone Hello there. I'm glad that you and your team have spent some time to integrate my approach on real project. Or at least check the functionality. I cannot but mention that this is not solution for Selenide. This is an implementation of WebDriver interface. Selenide is build on the top of Selenium. But I'll look into this issues and try to fix them.

hazyone commented 3 weeks ago

Yes, I understand the difference. That's why I made a remark that this is a view from the side of a person who tried to use the library together with the Selenide wrapper and also I found this library in an article on medium where connection to Selenide is mentioned :)

I just pointed out, that Selenide is huge and has a lot of hacks, that make migration very difficult. But in case you work with "clean" Selenium, I think that your library can be a game changer for the teams that are wondering to switch to PW. Nice work! :)

britka commented 3 weeks ago

@hazyone Thank you. That was the point why I began working on Playwrightium. The idea was to keep using Selenium/Selenide but run tests within Playwright. You comments are unpriceable. I'll try to fix all that issues. If you find something new please let me know.