Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic link and Regular expression
12-27-2010, 06:50 PM
Post: #1
Dynamic link and Regular expression

Hi All,

In recent Interview I have asked one Question on how to click a link.
The scenario is as below.

On the First page, we have text box.
We have to enter the required text in the Text box, click on Submit button.
On Next page dynamic link generated based on entered text in previous page.

For example

If we enter Shashi Kiran, the link displayed on the next page is
UFC 125:Shashi Kiran's video Interview.

If we enter only Kaitrina,the link name displaced is
UFC 125:Katrina Kai's video Interview.

Here 'UFC 125:' and 'video Interview' remain's constant.

Also the displayed link position on the next page is not constant.It displayed alphabetaly in desc order.

How we handle this situation ?
Find all posts by this user
Quote this message in a reply
12-28-2010, 09:20 AM
Post: #2
RE: Dynamic link and Regular expression
it's not required that you should use regualar expression.
you can use descriptive programming for this by forming the links innertext/innerhtml with the input text you entered in the last page.

Thanks,
~Saket Kumar
Linkedin| pdf Api for QTP
| Automated-360

It's so hard when I have to, and so easy when I want to...
Find all posts by this user
Quote this message in a reply
12-28-2010, 11:30 AM
Post: #3
RE: Dynamic link and Regular expression
Hi Saket,
thnks for your valuable reply.
I am not able to validate below script, as it is generic and not related to any particular application.
But still want to conform if below script/approach is correct or wrong.

To enter value in text box

Browser("name:=orkut - login").Page("name:=orkut - login").WebEdit("text:=Video to search").Set "Kaitrina Kaif"

To get entred text in a variable.

a= Browser("name:=orkut - login").Page("name:=orkut - login").WebEdit("text:=Video to search").Getroproperty("text")

To click on Submit button

Browser("name:=orkut - login").Page("name:=orkut - login").Webbutton("value:=Submit")

To click the rquired link.

Browser("name:=orkut - login").Page("name:=orkut - login").Weblink("html tag:=A","inner html:=UFC 125:Katrina Kai's video Interview").click

Please let me know, if i am correct up to this.
Now the problem here is, I want to make above script run for any Text entered in first page.

In the innerhtml Instead of 'Katrina Kai's', I want to pass the variable value I captured during runtime in

a= Browser("name:=orkut - login").Page("name:=orkut - login").WebEdit("text:=Video to search").Getroproperty("text")

Please correct me if my approach is correct.
Find all posts by this user
Quote this message in a reply
12-28-2010, 11:37 AM
Post: #4
RE: Dynamic link and Regular expression
Yes, you in right direction
take a variable and store your input string into it, and use it for the link

e.g
Code:
strInput = "Kaitrina Kaif"
Browser("name:=orkut - login").Page("name:=orkut - login").WebEdit("text:=Video to search").Set strInput
'... rest of the statements to submit
Browser("name:=orkut - login").Page("name:=orkut - login").Weblink("html tag:=A","inner html:=UFC 125:" & strInput & "'s video Interview").click

Thanks,
~Saket Kumar
Linkedin| pdf Api for QTP
| Automated-360

It's so hard when I have to, and so easy when I want to...
Find all posts by this user
Quote this message in a reply
12-28-2010, 11:51 AM
Post: #5
RE: Dynamic link and Regular expression
Thank you very much Saket Smile
Find all posts by this user
Quote this message in a reply
03-03-2011, 02:16 PM
Post: #6
RE: Dynamic link and Regular expression
Its very useful. Thank you....but my application Silverlight 4.0. can u give dynamic link validation for supporting silverlight 4.0 application
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Need help with regular expression Please Assist RA185112 5 535 02-15-2013 01:56 PM
Last Post: selvam
  LInk reg expression QAVA 3 503 02-14-2013 11:06 AM
Last Post: Ankesh
  Very interesting issue with regular expression Please Help Me :) dzordz 3 806 02-01-2013 01:35 PM
Last Post: RA185112
  regular expression on Window object qupi 4 586 11-19-2012 08:18 AM
Last Post: qupi
  Help Again with regular expression jinnah 10 1,321 09-28-2012 04:18 AM
Last Post: jinnah



User(s) browsing this thread: 1 Guest(s)