Forum Discussion

wynfranc1234's avatar
wynfranc1234
Contributor
11 years ago
Solved

Flex- Cannot click the item that is not visible in the dropdown list

Hi.



My system  is using  Java and Flex app(Debug version) and when I click an item in a drop down list that is visible in the screen, TC can click and select the item (using an index). But if the drop down list contains a lot of records, let's say 100 and I want to select item 90 with text of "Sample", the object item cannot be found nor can't be clicked as it is not visible immediately on the screen. As a workaround I have to Key the first letter (S) and then use the key down arrow until it finds item 90 or the "Sample" item. Does anyone has this problem and is there an easier way to Select an item in a dropdown list without knowing the index but just the text?



Details:

advancedlist0  (name of drop down list), Only method Available with Click is "ClickItem".



I'm using TC version 10.0.531.7
  • Hmm, so you're saying it's too far off the screen and not yet visible? Do you know the css selectors on that particular item? You could use querySelector if you know that item has a particular id... Would be roughly the same



    page = Sys.Browser("*").Page(whateverurl or just use "*");



    result = page.querySelector("#objectid");

    result.click();



    I'm not sure how the simulation of clicking the object will work if it's not on the page though... Let me know if this helps at all

6 Replies

  • Changing the text does not actually fix the issue. After a few tries, found the following Flex command (selectedIndex) and after setting the index, the combo item was changed and propertly set. 



                      comboBoxobject.FlexObject.selectedIndex = ???



    ??? -  value of index of field, which I got after comparing the text to the description of the item in the Flexobject.dataProvider list.





  • tpotter's avatar
    tpotter
    Occasional Contributor


    I would use the Find Method



    Something like this..



     



    var currPage, obj;



    currPage = Sys.Browser("*").Page("*");          //Or whatever the page URL and browser are



    obj = currPage.Find("ContentText", "sampletext", 50);  //Give it a big depth to search the page.



    **EDIT**



    Make sure that you find and click the drop down menu first, so the object is visible first.



    obj.Click();


  • Thanks! But still can't select the item as the property contentText is not showing up in the current page. I can't also see an Innertext property  when I use the debug to check the values of the current page. It will click the drop down item but then waits for a long time and seems like it get stuck in the Find.
  • tpotter's avatar
    tpotter
    Occasional Contributor
    Hmm, so you're saying it's too far off the screen and not yet visible? Do you know the css selectors on that particular item? You could use querySelector if you know that item has a particular id... Would be roughly the same



    page = Sys.Browser("*").Page(whateverurl or just use "*");



    result = page.querySelector("#objectid");

    result.click();



    I'm not sure how the simulation of clicking the object will work if it's not on the page though... Let me know if this helps at all
  • Thanks for the help!. Since this is a Flex app, finally found the shortcut :




      //Get the Combobox object via TestComplete's spy


      var combobox1 =   Sys.Browser("iexplore").Page("http://...html")....BRComboBox("ComboBoxName");


        


     combobox1.FlexObject.text = "ValueOfDropdownList";