Quality Testing

Quality is delighting customers

Hi,

 

           There is a webpage having 100 edit boxes with same properties without attached text.How to set the data for 48th edit box using Scripting.

 

Thanks in advance

Views: 2848

Reply to This

Replies to This Discussion

Hi Divya,

 

There are different ways to write the code for this scenario. I am describing one way

 

1. Add any one of the edit box to Object Repository (as there are 100 edit boxes which have same prop)

2. Write down the index number for that edit box from Object properties (Index no. will be different for all the edit boxes even though remaining properties are same)

3. Write the code as below

Browser().Page().Frame().WebEdit().SetTOProperty "index",48 (For 48th edit box)

Browser().Page().Frame().WebEdit().Set "Hello"

 

So, the above statements first set the index number of the webedit to 48 and set the data in that edit box later.

 

Let me know if you have any questions

 

Thank you

Hi,
Can u plz give the solution for this


There is a web table containing five columns but those columns are interchanging their positions.Assume one of the column name Company,and the another column name was Company URL.
"Then how to find out the required company was present in the company column,if it is present then we have to click on that company URl link".Plz send me the script for that.


Thanks in advance

Hi,

 

I didn't get you clearly. This might be solution you are looking for based on my understanding.

Let us say, company name- tcs which is present in 1st column and 3rd row.

Comapny URl is in 2nd column,3rd row

 

Rowcount= Bro().Page().WebTable().Rowcount

For i=2 to Rowcount

vCompany = Bro().Page().WebTable().Getcelldata(i,1))

If StrComp(vCompany,"tcs") =0 Then

Bro().Page().WebTable().ChildItem(i,1,"WebLink",0).Click --- Clicks the company URL

Exit For

End If

Next

Thank you for u r reply.

        That script was suit if the columns positions in web table are constant.I need a code for columns in web table are changing their positions.

 

 

Hi,

 

     can we create shared repository other than .tsr extension,if yes what are the extensions?

Plz reply asap

 

Thank you in advance

yes

If the columns are interchanging, First read out the column headers and retrieve the data

 

v1 = Bro().Page().WebTable().Getcelldata(1,1)

v2 = Bro().Page().WebTable().Getcelldata(1,2)

If Strcomp(v1,"Company")=0 Then

j=1 --- First column

Else

j=2 ---- Second Column

ctr=0

End If

 

Rowcount= Bro().Page().WebTable().Rowcount

For i=2 to Rowcount

vCompany = Bro().Page().WebTable().Getcelldata(i,j)

If StrComp(vCompany,"tcs") =0 Then

If ctr=0 then

Bro().Page().WebTable().ChildItem(i,j-1,"WebLink",0).Click

Else

Bro().Page().WebTable().ChildItem(i,j+1,"WebLink",0).Click --- Clicks the company URL

End If

Next

 

RSS

TTWT Magazine


Advertisement

Advertisement

Advertisement

Advertisement

© 2020   Created by Quality Testing.   Powered by

Badges  |  Report an Issue  |  Terms of Service