Forum Discussion

sarya's avatar
sarya
Frequent Contributor
14 years ago

How to assign a webpage value to a test object on the webpage

Hi,



I have a script where I need to get a date value from some different screen and then click on a test object having the same value on a different webpage .I was able to retrieve the value from the first webpage.The second screenshot contains the object with the same value where I need to click using the retrieved value.



// I retrieved the value like this:



page1 = Sys.Process("iexplore").Page("http://" + servername + ":" + port + "/" + r2wcontext + "/"  "publicationPropertiesGet.do*");

value = aqObject.GetPropertyValue(page1.document.all.Item(62),"innerText");



value comes like this : 28 Jul 2010 09:52 AM EDT 9:52:56 .



Now how to use this retrieved value in the script to click an object on another screen with same value. I cannot call the object using the id as it changes everytime the timesatmp changes,so how to use a retrieved value as anothe rvalue to be clicked on some other page.Is there any specific function for this?



Thanks,

Sumedha

3 Replies

  • Hi,



    Use the Find method (see the "Find Method" help topic). You just need to know the property name which holds the needed value in the target object.
  • sarya's avatar
    sarya
    Frequent Contributor
    Hi Jared,



    I retreived the value like this using GetPropertyValue :



    page1 = Sys.Process("iexplore").Page("http://" + servername + ":" + port + "/" + r2wcontext + "/"  "publicationPropertiesGet.do*");

    link = aqObject.GetPropertyValue(page1.document.all.Item(62),"innerText");



    Tha value of the "link" variable comes like this : 28 Jul 2010 09:52 AM EDT 9:52:56 .



    Now I need to assign the above retrieved value to another variable so that I can use click operation on a link having this value :28 Jul 2010 09:52 AM EDT 9:52:56  .Which function can I use to assign a variable the value retrieved with the name "link" from the above code.



    Thanks,

    Sumedha


  • Hi,



    If you need to click the same link, you just need to call its Click method:

    page1.document.all.Item(62).Click()


    I'm not sure why you need to obtain its text and then click it by this text.



    As for assigning a variable value to another variable, use '=' to do this.