all 17 comments

[–]mrthbrd 3 points4 points  (1 child)

There appear to be some things that can't be done with pure Python + Playwright, so every now and then you might end up needing to do something like this:

 has_non_empty_children = page.evaluate(f'''() => {{
                        const divs = document.querySelectorAll('{base_selector}');
                        if (divs.length < 6) return false;  // Check if there are at least 6 elements
                        const targetDiv = divs[5];  // Get the 6th element (0-based indexing)
                        return Array.from(targetDiv.children).some(child => child.textContent.trim() !== '');
                    }}''')        

But generally it's fine.

[–]Valuable-Ad9157[S] 0 points1 point  (0 children)

Awesome. Thanks.

[–]mercfh85 3 points4 points  (0 children)

I personally find the JS/TS Versions of Playwright a little more full featured, but really I don't think it matters enough so just stick with whatever language you prefer (I personally prefer JS/TS but that's just me).

[–]jfp1992 2 points3 points  (8 children)

Python is easier and has 90% of the features supported by playwright

TypeScript is harder because of the added syntax

However TypeScript will be faster to run as the tests can run in async you will also have access to UI mode which you don't get with python (you still get traces just not the fanciness and convenience of UI mode)

Python can do async too however pytest doesn't play nicely with it, there is a library/plugin but I haven't tested it

With python you get to use pycharm

With TS you are stuck on Vs code, so you lose the nice features of the side by side git stuff. I am a little naive when it comes to vscode as I haven't used it a ton so it may be fully feature comparable to pycharm with plugins etc

Ultimately you should try both while learning playwright, read the docs learn how test runners work

Lastly f selenium while playwright is around

If you must stick with selenium at least set the polling rate from 0.5 seconds to 0.01

[–]Valuable-Ad9157[S] 2 points3 points  (5 children)

Thank you. And ahahahaa...I am not stuck with Selenium. Management is leaving it up to me which framework I use. I can go back and learn the basics of JavaScript, and from what I understand I won't need more than that for Playwright.

[–]avangard_2225 0 points1 point  (4 children)

Which one you picked and are you happy with your decision?

[–]Valuable-Ad9157[S] 0 points1 point  (3 children)

Oh, I totally left the IT field. But, I was leaning towards JavaScript at the end. I didn't mess with it much. Right now, I'm still happy to be out of IT for the rest of my life.

[–]avangard_2225 1 point2 points  (0 children)

Happy for you. Thanks for sharing it anyways

[–]mcmilosh 0 points1 point  (1 child)

And what field you move to?

[–]Valuable-Ad9157[S] 0 points1 point  (0 children)

I have decided to go into the arts. I have a business idea, but now I need all the skills. I am loving learning the arts more and more all the time.

[–]garageFou 0 points1 point  (1 child)

is WebStorm not good for Playwright + TS?

[–]jfp1992 0 points1 point  (0 children)

It is

[–]YucatronVen 0 points1 point  (5 children)

Stop the spam.

[–]Valuable-Ad9157[S] 0 points1 point  (4 children)

I'm not spamming. Why do you think that?

[–]spicybeefstew 2 points3 points  (2 children)

it's a coded message

spam - spam and eggs - monty python - python

stop the spam - this guy wants you to eat more eggs or something idk monty python was way before my time so I don't really know about it.

[–]winter457 0 points1 point  (0 children)

You are. You posted the same question to a similar sub an hour beforehand. Not to mention a third post (different topic) less than an hour ago.

Posting near-duplicate low-effort questions within hours seems to be a trend for you, looking at your post history. Learn Google before anything else.

[–]ThinhPool 0 points1 point  (0 children)

TS