Ask a Question

dynamic table values

lambada
Contributor

dynamic table values

Hello everybody!

 

I would like to ask you what is the best way for coding a function in Java script for choosing (click) a value into a dynamic table?

 

Thank you for helping me in advance.

 

Best regards

lambada

31 REPLIES 31

Thank you I will try. So I don´t need to write a loop?

And I don´t need the "parent" as in this example.

This approach is working without loop.

 

Usage of Parent property depends on hierarchy of elements on your page. Analyze it using ObjectBrowser data.

The problem is, that the RowIndex changes! For example: if I create Anna0, the RowIndex of Anna3 will after that be RowIndex=4. Bevore the creation of Anna0, the RowIndex of Anna3 was 3.

 

So I think there I need a loop that will "count" and go step by step through the table and search "Anna3" for clicking on Anna3.

 

 

Let it changes. Just call required object (Anna3) after the new one (Anna0) was created. 

 

If your main action is just to click directly on element Anna3, you can still do it using Find() method. Something like:

 

Aliases.yourPage.Find("contentText", "Anna3", 10).Click()

 

Thank you, I will try.

 

And what control you recommend for opening number 3 (the blue box)? It should click on number 3 first bevore the table with Anna´s opens.

I don't know, while you have not provided us with the source code of this page or the ObjectBrowser data. 🙂

Also you can use Object Spy to find required control and check its properties. 

Hi baxatob

 

Unfortunately 

 

var url = "https://.........";

var page = Sys.Browser("chrome").Page(url);

...

Aliases.page.Find("Anna3", "Anna3", 10).Click(); was not working.

 

Aliases.yourPage.Find("contentText", "Anna3", 10).Click()

 

Are there any other methods?


@lambada wrote:

Aliases.page.Find("Anna3", "Anna3", 10).Click(); was not working 

 


There are two possible issues:

 

1) You have assigned a page variable and then used it with Aliases. If you want use Aliases, you need to map your elements into the NameMapping repository. Otherwise you should call only page.Find(...) 

 

2) Find("Anna3", "Anna3", 10) - will not work ever, because the first argument should be the object property. Most probably it's a contentText, but better if you will check it using Object Browser.

Ok, thank you. I will change page.Find(...);

 

I looked up the contentText with object spy, and the value was also Anna3.

cancel
Showing results for 
Search instead for 
Did you mean: