Rayrun
โ† Back to Discord Forum

glob vs regex - page.waitForURL (solved)

Hi, I guess i must have overlooked something in the documentation but I can't quite figure it out. waitForURL parameter URL can be "A glob pattern, regex pattern or predicate receiving URL"

In my test I need to wait for a url ending with a hash, like "https://www.xy.com/success#hash".

using glob: page.waitForURL('https:///www.xy.com/success*') works using regex: page.waitForURL('https:///www.xy.com/success.*') does not work.

Why? How can Playwright even figure out if I want to use a glob or a regex? In Regex asterisk (*) means "match zero or more of the preceding character" So the first example could well be a regex matching succes, success, successsssssss ...

thanks for hints!

This thread is trying to answer question "Why does the glob pattern work for page.waitForURL but the regex pattern does not, and how does Playwright distinguish between them?"

2 replies

Got it - have to pass in an actual regex using javascript syntax ๐Ÿ™‚

glob vs regex - page.waitForURL (solved)

Related Discord Threads

TwitterGitHubLinkedIn
AboutQuestionsDiscord ForumBrowser ExtensionTagsQA Jobs

Rayrun is a community for QA engineers. I am constantly looking for new ways to add value to people learning Playwright and other browser automation frameworks. If you have feedback, email [email protected].