Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a Web performance Script in Visual Studio. I have turned this into Coded Webtest in VB by clicking on the Generate Code button.

In my web test there are a 5 functions. Apart from the 1st the others are for SQL Procedures.

Among a few things, I need a web request that does a certain action. Based on that action, In the response body - it generates a Unique Id.

I need this Id to make it accessible across all the functions.

The Response body is something like this :

0x00000000  7B  22  69  64  22  3A  36  35  33  30  36  36  33  7D            {"id":2133221}  

Now I wanted to know, how do I do it. I just need 2133221.

I tried using the Context Parameter name and appending it to a .to string...it did not work. I tried doing by looking over the net and trying out a few options. I'm lost now. Can anyone help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
253 views
Welcome To Ask or Share your Answers For Others

1 Answer

The simplest solution is the below one.

str = "0x00000000 7B 22 69 64 22 3A 36 35 33 30 36 36 33 7D {""id"":2133221}"

arr = Split(str, ":")
strID = Left(arr(1), len(arr(1)) - 1)

msgbox strId

However, If you still need a more robust one, try regex


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...