Clicking an email verification link using jmeter

750 views Asked by At

I have a test plan in jmeter that does the following:

  1. uses a mail reader sampler to retrieve email from gmail account.

  2. uses a Regular Expression Extractor to grab a verify email link and set it to a variable

1-3 work fine the problem I am having is when I get the verify mail link it also captures the protocol https:// so once I try using a HTTP Sampler to get the link I get http:/"https:followed by the url.

How can I either exclude the http: protocol from my regular expression or is there another sampler I can use to click the link

Response I am parsing: href="https://qa4.iqnavigator.com/routing/YTMzYThjYzctNjIyNy00MWRmLTlhOGItOTdiNWVjMDY1YWFm">

The regular expression I am using: "([^"]+?)" and what is captured: https://qa4.company.com/routing/YTMzYThjYzctNjIyNy00MWRmLTlhOGItOTdiNWVjMDY1YWFm

any ideas

1

There are 1 answers

1
AA Ron On BEST ANSWER

I believe that the solution to your issue is careful use of character groupings and JMeter's "template" feature of the regular expression extractor.

For example, this RegEx:

https://([^/]*)/

Using the Template:

$1$

This will match urls, but not include the "https://" part or the path after the host, in the actual variable stored by JMeter. This will only store the host itself, in your example "qa4.iqnavigator.com".

Another example, lets say you only wanted to extract the routing ID, but you aren't sure it will be http or https:

href=".*://qa4.iqnavigator.com/routing/([^"]*)"
Template:  $1$

For more details, check out this answer.

Let me know if I can try to clarify further.