How to use regex with Page.WaitForURL() #439
              
                Unanswered
              
          
                  
                    
                      AkashKarnatak
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 3 comments
-
| 
         could you please try this?  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| 
         For some strange reason it isn't working. It times out, This is what I tried.   r, err := regexp.Compile(".*myaccount.google.com.*")
  if err != nil {
    return "unable to compile regex: %v", err
  }
  if _, err := page.WaitForNavigation(playwright.PageWaitForNavigationOptions{URL: r});
    err != nil {
    return "could not reach myaccount.google.com: %v", err
  }The URL that web browser navigates to is    r, err := regexp.Compile(".*myaccount.google.com.*")
  if err != nil {
    panic(err)
  }
  fmt.Println(r.MatchString("https://myaccount.google.com/?pli=sd"))The above code prints  Btw I also tried,   if err := page.WaitForURL("myaccount.google.com"); err != nil {
    handlef("could not reach myaccount.google.com: %v", err)
  }which simply worked. But I am unable to figure out why regex isn't working  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            -
| 
         This works for me:  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
The nodejs equivalent of
Page.WaitForURL()allows one to pass regex objects. Is there a way to achieve similar functionality in golang?Maybe something like this.
Beta Was this translation helpful? Give feedback.
All reactions