RepoItemInfo runtime creation
Posted: Tue Mar 12, 2019 4:17 pm
Code: Select all
public static void selectTextItemFromSizeAndRating(string itemToSelect){
List combo = ProDesign.CableSettingsDialog.ComboBox_SizeRating;
RxPath comboPath = ProDesign.CableSettingsDialog.ComboBox_SizeRatingInfo.AbsolutePath;
Ranorex.Core.Repository.RepoItemInfo comboInfo = ProDesign.CableSettingsDialog.ComboBox_SizeRatingInfo;
IEnumerable<Ranorex.Core.Repository.RepoItemInfo> childrenInfo = ProDesign.CableSettingsDialog.ComboBox_SizeRatingInfo.Children;
combo.EnsureVisible();
combo.Click();
var items = combo.Items;
var totalItems = items.Count;
//List<Ranorex.Core.Repository.RepoItemInfo> items1 = (List)childrenInfo;
for(int i = 0; i< items.Count;i++) {
Ranorex.Core.Repository.RepoItemInfo itemInfo = new Ranorex.Core.Repository.RepoItemInfo(comboInfo.ParentFolder,"itemInfo",new RxPath(comboPath+"//listitem["+i+"]/"),1000,false,"99999999-9999-9999-9999-999999999999");
string abc = itemInfo.FindAdapter<Text>().GetAttributeValue<Text>("name").ToString(); // FAILS IN THIS LINE//
System.IO.File.WriteAllText(@"C:\Rajee\sizerating.txt",abc);
ListItem item = items[i];
string itemTextSize = ((ListItem)item).Children[0].Element.GetAttributeValue("name").ToString();
string itemTextRating = ((ListItem)item).Children[1].Element.GetAttributeValue("name").ToString();
//itemText = itemText.Replace("/", String.Empty);
string itemText = new StringBuilder(itemTextSize).Append("/").Append(itemTextRating).Replace(" ", "").ToString().ToUpper();;
itemInfo=null;
if(itemToSelect.Equals(itemText)) {
combo.SelectedItemIndex = i;
break;
}
}
Failed to find item 'DesignerSuiteAutomatedTestingRepository.ProDesign2016.Dialog_CableSettings.itemInfo'.
No element found for path '/form[@title='Cable Settings' or @title~'^Final\ Circuit\ ' or @title~'^Lighting\ Column\ ' and @processname='ProDesign']/form[@title='Cable Settings' or @title~'^Final\ Circuit\ ' or @title~'^Lighting\ Column\ ' and @processname='ProDesign']/container[@automationid='Main']//container[@automationid='ComponentSettingsView']/container/container/element[@automationid='PageContentControl']//container[@automationid='CableTypeViewElement']/container/container[6]/list[@automationid='RatingComboBox']//listitem[0]' within 31s.
Show/Hide Stacktrace
at Ranorex.Core.Repository.RepoItemInfo.FindInternal[T](Boolean findSingle, Boolean throwException, Duration effectiveTimeoutOverride)at Ranorex.Core.Repository.RepoItemInfo.<>c__DisplayClass75_0`1.<Find>b__0()at Ranorex.Core.Testing.Services.NoMaintenanceModeService.HandleElementNotFound[T](Func`1 action, RepoItemInfo entry)at Ranorex.Core.Repository.RepoItemInfo.Find[T](Boolean findSingle, Boolean throwException, Duration effectiveTimeoutOverride)at Ranorex.Core.Repository.RepoItemInfo.CreateAdapter[T](Boolean throwException, Duration waitTimeout)at Ranorex.Core.Repository.RepoItemInfo.CreateAdapter[T](Boolean throwException)at Ranorex.Core.Repository.RepoItemInfo.FindAdapter[T]()at ProdesignAutomatedTesting.ProDesign_Files.UI_Elements_Engine.CablesHelper.selectTextItemFromSizeAndRating(String itemToSelect) in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\UI Elements Engine\CablesHelper.cs:line 281at ProdesignAutomatedTesting.ProDesign_Files.UI_Elements_Engine.CablesHelper.SelectCable_SizeAndRating(String itemToSelect) in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\UI Elements Engine\CablesHelper.cs:line 103at ProdesignAutomatedTesting.ProDesign_Files.ProDesign_Dialog_Events.EditProperties.SelectCable_SizeAndRating(String sTextToSelect) in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\ProDesign Dialog Events\EditProperties.cs:line 470at ProdesignAutomatedTesting.ProDesign_Files.ProDesign_Test_Setup_Files.Draw_NewCableDataTest.Ranorex.Core.Testing.ITestModule.Run() in c:\git\designsuiteautomatedtesting\ProdesignAutomatedTesting\ProdesignAutomatedTesting\ProDesign Files\ProDesign Test Setup Files\Draw_NewCableDataTest.cs:line 208at Ranorex.Core.Testing.TestModuleLeaf.RunInternal(DataContext parentDataContext, Int32 iteration, Int32 iterationCount, Boolean skipIteration)
Here I am trying to create an repoiteminfo for each element in the list, any idea as to how to go forward with this one?
Thanks,
rajee