Quantcast
Channel: New board topics in SmartBear Community
Viewing all articles
Browse latest Browse all 21061

Wildcard Not Recognized in URL within an Email

$
0
0

Currently using TC 11.20 and writing scripts using Python. I am working on a script that checks the body content of my last email in my inbox (Outlook).  My end goal is to click a URL within an email to reset a password. My code can identify the URL when I do not put a wildcard at the end, but then the URL is incorrect (should have 'password-reset/b632ffa303463b9445a5685697b0e352' on the end for this example). The URL will change each time the "Forgot Password" link is clicked within the application. Any ideas how I can get this to work? Thanks in advance for your help!

 

def check_email():
  msOutlook = Sys.OleObject["Outlook.Application"]
  mapi = msOutlook.GetNamespace("MAPI")
  inbox = mapi.Folders("test@test.com").Folders("Inbox")
  messages = inbox.Items
  message = messages.getLast()
  body_content = message.body
  url = "http://qaregapps.testurl.com:123456/test/admin/password-reset/*" 
  Log.Message(body_content)

  if url in str(body_content): 
    Browsers.Item(btFirefox).Navigate(url)
    Log.Message(url) 
      
  else:
      Log.Message("Email not received.")

Viewing all articles
Browse latest Browse all 21061

Trending Articles