Forum Discussion

OV's avatar
OV
Frequent Contributor
7 years ago
Solved

How do i click an item

This is my function:

 

function SelectSeries(SeriesIndex)
{
PropArray = "WPFControlText"
ValuesArray = "Printer*"
ProjectsArray = Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.FunctionalItemsControl.Tree.FindAllChildren("ClrClassName", "TreeViewItem", 1).toArray()
for(j = ProjectsArray.length - 1 ; j >= 0 ; j--)
{
Log.AppendFolder("Set series for printers list under " + ProjectsArray[j].DataContext.Project.Name.OleValue)

ProjectsArray[j].Click();
PrintersArray = ProjectsArray[j].FindAllChildren("WPFControlText", "Printer*", 6).toArray()
for( i = 0; i < PrintersArray.length; i++)
{
Log.Message(ProjectsArray[j].Items.Item(i).Name.OleValue)
ProjectsArray[j].Items.Item(i).Click(); 

//Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.FunctionalItemsControl.Tree.TreeViewItem.WPFObject("TreeViewItem", "", i+1).Click();
SeriescomboBox = Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.Grid.AppStateGrid.ComboboxSeries
Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.Grid.AppStateGrid.ComboboxSeries.ClickItem(Random(0, 11));
Log.Message("Series ComboBox value - " + ProjectsArray[j].Items.Item(i).Name.OleValue)
SelectModel(Random(0, 3))
}
Log.PopLogFolder()
}

}

 

this line return an error

 

ProjectsArray[j].Items.Item(i).Click(); 

 

How do i click/select/focus an item in this case?

 

Thanks

  • SOLVED

     

    // Select Series for printer
    // Index - The index of the series to add from the combobox
    function SelectSeries(SeriesIndex)
    {
    PropArray = "WPFControlText"
    ValuesArray = "Printer*"
    ProjectsArray = Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.FunctionalItemsControl.Tree.FindAllChildren("ClrClassName", "TreeViewItem", 1).toArray()
    for(j = ProjectsArray.length - 1 ; j >= 0 ; j--)
    {
    Log.AppendFolder("Set series for printers list under " + ProjectsArray[j].DataContext.Project.Name.OleValue)
    ProjectsArray[j].Click();
    PrintersArray = ProjectsArray[j].FindAllChildren("WPFControlText", "Printer*", 6).toArray()
    for( i = 0; i < PrintersArray.length; i++)
    {
    Log.Message(ProjectsArray[j].Items.Item(i).Name.OleValue)

    SeriescomboBox = Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.Grid.AppStateGrid.ComboboxSeries
    Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.Grid.AppStateGrid.ComboboxSeries.ClickItem(Random(0, 11));
    Log.Message("Series ComboBox value - " + ProjectsArray[j].Items.Item(i).Name.OleValue)
    SelectModel(Random(0, 3))
    }
    Log.PopLogFolder()
    }

5 Replies

  • OV's avatar
    OV
    Frequent Contributor

    SOLVED

     

    // Select Series for printer
    // Index - The index of the series to add from the combobox
    function SelectSeries(SeriesIndex)
    {
    PropArray = "WPFControlText"
    ValuesArray = "Printer*"
    ProjectsArray = Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.FunctionalItemsControl.Tree.FindAllChildren("ClrClassName", "TreeViewItem", 1).toArray()
    for(j = ProjectsArray.length - 1 ; j >= 0 ; j--)
    {
    Log.AppendFolder("Set series for printers list under " + ProjectsArray[j].DataContext.Project.Name.OleValue)
    ProjectsArray[j].Click();
    PrintersArray = ProjectsArray[j].FindAllChildren("WPFControlText", "Printer*", 6).toArray()
    for( i = 0; i < PrintersArray.length; i++)
    {
    Log.Message(ProjectsArray[j].Items.Item(i).Name.OleValue)

    SeriescomboBox = Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.Grid.AppStateGrid.ComboboxSeries
    Aliases.QuickDesign_ConfigurationManager.HwndSource_This2.This.Grid.AppStateGrid.ComboboxSeries.ClickItem(Random(0, 11));
    Log.Message("Series ComboBox value - " + ProjectsArray[j].Items.Item(i).Name.OleValue)
    SelectModel(Random(0, 3))
    }
    Log.PopLogFolder()
    }

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    What error are you getting?  That will help in understanding better how to help you.

    • OV's avatar
      OV
      Frequent Contributor

      Hi Robert,

       

      I've solved this issue myself already but, if you still want to see the error i got let me know and i'll regenerate it for you.

       

      Thanks

      • tristaanogre's avatar
        tristaanogre
        Esteemed Contributor

        No need to repost the error.  I am curious, though, as to what the issue was and how you resolved it.