Hello everyone
Our application, which is an ERP system, is opening tabs with dynamically generated names. For example when I open the stock lists in our software to add new articles it will generate a name for that tab page according to the new given article number which is automatically generated. Please have a look at File 1 as an example. So in this example I created an article which is now dispayed in the page tab called 'Artikelstamm-872120.g' 'Artikelstamm-' is static but the rest is the article number my new article was given. I would like to know a way so I am able to store the value within a variable to be able to identify the correct page tab later on, for example to close just that one tab but leave other tabs open. Or in other words, to be able to identify the correct page tab to do further actions on it. The problem is, whenever I add new articles to the software, I do not know the article number given beforehand so I need a way to get the value, store it so i can assign it to be able to identify the correct page tab later on. I hope this is possible somehow.
Unfortunately I am not familiar with coding and checking guides and FAQ did not provide me with the answer I was looking for. I am sorry if I have missed that page or did not understand how I could implement this in my test environment.
If you need more information or whatever, feel free to ask.
Thanks in advance for you help.
Storing dynamically generated page tab as value
Storing dynamically generated page tab as value
You do not have the required permissions to view the files attached to this post.
Re: Storing dynamically generated page tab as value
Mos,
Welcome to the Ranorex community!
There are a couple of things that you could do, depending on how your software under test is designed:
1. Does the software use an algorithm to determine the name, or is it a random generator? If there is an algorithm, you could implement a mirror in your test's user-code.
2. Does the newest tab always open in the last position (i.e., always in the right-most position)? If so, you could search for the tab after it is created by assuming that the right most tab is the correct one (this is, however only a valid assumption if the software actually works that way).
Welcome to the Ranorex community!
There are a couple of things that you could do, depending on how your software under test is designed:
1. Does the software use an algorithm to determine the name, or is it a random generator? If there is an algorithm, you could implement a mirror in your test's user-code.
2. Does the newest tab always open in the last position (i.e., always in the right-most position)? If so, you could search for the tab after it is created by assuming that the right most tab is the correct one (this is, however only a valid assumption if the software actually works that way).
Shortcuts usually aren't...
- testautomator
- Posts: 67
- Joined: Fri Oct 25, 2013 6:37 am
- Location: Bangalore, India
Re: Storing dynamically generated page tab as value
Also, you could compare the new one against the stored names of the all the previous tabs. If it dosent match then its a new one and it goes into the list. But this depends on the functionality.
Yes, the best one is checking it in the last position for any new tab, if that is true.
Yes, the best one is checking it in the last position for any new tab, if that is true.
Re: Storing dynamically generated page tab as value
Hello krstcs and testautomator
Thanks for your replies. Much appreciated.
How could I search for that? Unfortunately, I do not know how I could do this.
Thanks again for your replies and your time. Hopefully you can shed some light in the dark
Thanks for your replies. Much appreciated.
The software has a way of generating new id's and therefore new article numbers but it is as simple as that. It just checks for the next free available number and takes it. You can also use a specific number if you want so it could be that you do not know in advance which number is free and therefore not used yet.krstcs wrote:1. Does the software use an algorithm to determine the name, or is it a random generator? If there is an algorithm, you could implement a mirror in your test's user-code.
The newest tab will always open in the right-most position.krstcs wrote:2. Does the newest tab always open in the last position (i.e., always in the right-most position)? If so, you could search for the tab after it is created by assuming that the right most tab is the correct one (this is, however only a valid assumption if the software actually works that way).
How could I search for that? Unfortunately, I do not know how I could do this.
Same here. I do not know how I could compare new tabs against the already stored ones and determine which one is the new tab. I just starting using Ranorex and test automation tools all together even though I have learned quite a bit already.testautomator wrote:Also, you could compare the new one against the stored names of the all the previous tabs. If it dosent match then its a new one and it goes into the list. But this depends on the functionality.
Thanks again for your replies and your time. Hopefully you can shed some light in the dark
- testautomator
- Posts: 67
- Joined: Fri Oct 25, 2013 6:37 am
- Location: Bangalore, India
Re: Storing dynamically generated page tab as value
You are welcome,
Now how to find where the tab is, use spy. Maybe you should see some videos on how to modify the objects xpath and other introductory videos from Ranorex.
Also, you can use some kind of array to store the tab name and then compare new one against it. But I suggest go with the tab opened is the right most or left most. Look at the structure where the tab appears.
Now how to find where the tab is, use spy. Maybe you should see some videos on how to modify the objects xpath and other introductory videos from Ranorex.
Also, you can use some kind of array to store the tab name and then compare new one against it. But I suggest go with the tab opened is the right most or left most. Look at the structure where the tab appears.
Re: Storing dynamically generated page tab as value
I have watched the tutorial videos but unfortunately it did not help me in solving this specific problem or maybe I could not adapt it to my problem. If you have a look at the attachment included in this post, the new tabs will always be listed under TabPageList'PageTabList' as a new element but since I do not know the given name before hand, I cannot find it anymore as soon as I get a new article number. Hence my idea was to store 'Artikelstamm-872120.g' in a variable once the new article got assigned a new number and thus I could make a repository variable and look for that afterwards (something like @accessiblename='$ArtVar') but I do not know how I could get the value 'Artikelstamm-872120.g' and save it into @accessiblename='$ArtVar', if this is possible at all.
You do not have the required permissions to view the files attached to this post.
- testautomator
- Posts: 67
- Joined: Fri Oct 25, 2013 6:37 am
- Location: Bangalore, India
Re: Storing dynamically generated page tab as value
You could use regular expression to find the article name if it always started with 'Artikels' or "Artikelstamm-":
I am using code here but you can modify the xpath in the repository too.
Tabpage tabTemp = "your xpath till the tabpagelist";
Tabpage newTab = tabTemp.FindSingle("Artikels.*");
// If you want the name for the tab
string strTabName = newTab.getattribute("accessiblename"); or newtab.text;
I am using code here but you can modify the xpath in the repository too.
Tabpage tabTemp = "your xpath till the tabpagelist";
Tabpage newTab = tabTemp.FindSingle("Artikels.*");
// If you want the name for the tab
string strTabName = newTab.getattribute("accessiblename"); or newtab.text;
Re: Storing dynamically generated page tab as value
Hi testautomator
I have found another way to get around this, at least for now. Since I am no developer at all, it is not that easy for me to implement code but I can forward this to our developers and I am sure they can help me here
Thanks for your time and help, once again.
I have found another way to get around this, at least for now. Since I am no developer at all, it is not that easy for me to implement code but I can forward this to our developers and I am sure they can help me here
Thanks for your time and help, once again.
- testautomator
- Posts: 67
- Joined: Fri Oct 25, 2013 6:37 am
- Location: Bangalore, India
Re: Storing dynamically generated page tab as value
Your welcome. Try changing the xpath of the object in repository itself. Try it