Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic link and Regular expression
#1
Solved: 10 Years, 7 Months, 3 Weeks ago
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 ?
Reply
#2
Solved: 10 Years, 7 Months, 3 Weeks ago
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.

Reply
#3
Solved: 10 Years, 7 Months, 3 Weeks ago
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

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

To get entred text in a variable.

Code:
a= Browser("name:=orkut - login").Page("name:=orkut - login").WebEdit("text:=Video to search").Getroproperty("text")
To click on Submit button

Code:
Browser("name:=orkut - login").Page("name:=orkut - login").Webbutton("value:=Submit")
To click the rquired link.

Quote:
Code:
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

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

Please correct me if my approach is correct.
Reply
#4
Solved: 10 Years, 7 Months, 3 Weeks ago
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




Reply
#5
Solved: 10 Years, 7 Months, 3 Weeks ago
Thank you very much Saket Smile
Reply
#6
Solved: 10 Years, 7 Months, 3 Weeks ago
Its very useful. Thank you....but my application Silverlight 4.0. can u give dynamic link validation for supporting silverlight 4.0 application
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need Any digit in xpath path using Regular expression Priyam 1 3,221 10-05-2016, 11:05 AM
Last Post: Ankur
  Regular expression to read two words in lowercase, uppercase and with and without spa sarahq49 1 3,143 04-09-2015, 01:56 AM
Last Post: sarahq49
  Regular expression and script optimisation Padmavathy 1 3,593 03-30-2015, 11:46 AM
Last Post: supputuri
  Regular expression in descriptive programming testernc 1 16,370 12-08-2014, 06:38 PM
Last Post: anshika.agarwal
  need a regular expression. anu05446 0 2,982 11-26-2014, 03:00 PM
Last Post: anu05446

Forum Jump:


Users browsing this thread: 1 Guest(s)