Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Object does not exists
#1
Solved: 10 Years, 9 Months ago
Hi All,

A very stange thing is happinig when i m tring to use dynamic code in my project

Here is my code

i want to check whether this link exists or not

Code:
browser("name:=.*").page("title:=.*").Link("html tag:=A","text:=+(91)-22-67732000","class:=ctc f13").exist

It says object does not exist
when i m using repository for this its working fine in following case
Code:
browser("xyz").page("xyz").Link("+(91)-22-67732000").exist

can anyone suggest whats wrong?

One more point the following code works fine in the same script

Code:
browser("name:=.*").page("title:=.*").WebElement("html tag:=A","class:=jdv","index:=0").Exist
Reply
#2
Solved: 10 Years, 9 Months ago
Escape the special characters by '\'. For ex: "+" change to "\+"
"(" change to "\(" and ")" change to "\)"
Now try again .
Reply
#3
Solved: 10 Years, 9 Months ago
Thanks pradeep

it worked ....

now i want to add that number in datatable so the code will be

Code:
browser("name:=.*").page("title:=.*").Link("html tag:=A","class:=ctc f13","text:="&DataTable("Number", dtGlobalSheet)).Exist


datatable will have
Number
\+\(91\)-22-67732000

is this the right way to do this?
Reply
#4
Solved: 10 Years, 9 Months ago
As per my understanding ...instead of direct putting no. in dp ,you are fetching from datatable....
If I am right then,make a function and pass parameter fetching value from datatable and in that function you append '\' to all special characters .


For ex:
Code:
p=DataTable("Number", dtGlobalSheet)
pchanged=fnReplacingSpecialChars(p)

Function fnReplacingSpecialChars(p)
p=Replace(p, "(", "\(",,,1)
p=Replace(p,"+","\+",,,1)
p=Replace(p, ")", "\)",,,1)
fnReplacingSpecialChars=p
End Function

Then write this as :
Code:
browser("name:=.*").page("title:=.*").Link("html tag:=A","class:=ctc f13","text:="& pchanged).Exist(0)



Let me know ,Is it worked for you or not?
Reply
#5
Solved: 10 Years, 9 Months ago
Thanks Pradeep .... it really helped me
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Report Viewer showing hundreds of WebElement.Exists? themoon 1 2,223 03-09-2016, 02:43 PM
Last Post: vinod123
  How to check whether data exists in excel.. venkatesh9032 1 2,920 03-06-2014, 04:37 PM
Last Post: supputuri
  Verifying the value exists and if not, wait up to 5min HeZma 3 3,840 02-25-2012, 12:21 PM
Last Post: rajpes
  How to prove if an object exists? lucster 3 4,647 07-07-2011, 10:24 PM
Last Post: rajpes
  Object not found in object repository Even it exists There Rohit 4 11,824 03-21-2011, 07:04 PM
Last Post: Rohit

Forum Jump:


Users browsing this thread: 1 Guest(s)