Forum Discussion

TikiHardBop1's avatar
TikiHardBop1
Occasional Contributor
22 hours ago

TC not recognizing PrimeNg ContextMenu options

Yesterday, I updated to TestComplete 15.81.7.7 and now my tests are no longer able to select the context menu options. I am able to select a table row and I can right click on that row and the context menu options come up OK. I have code to look for them and TestComplete can find them OK, but the click() doesn't seem to do anything. 

I tried recording tests, and those work, but TestComplete always names them very specific to what is on the screen at the time and in a very odd way e.g. //td[.="value from cell in table"] which doesn't work with other data. 

In my code, a specific ContextMenu item named Fred will have the  xpath: 

//p-contextmenu//li[@aria-label="Fred"]//span[@class="p-contextmenu-item-label"][.="Fred"]

I can find it using the Chrome Dev Tools and I have code in TestComplete to verify its existence before I do a click and it exists, but the click doesn't seem to have any effect. 

Any help would be appreciated because this is a very hot task I am working on and will go a long way towards management approving more resources to TestComplete if I can get this done in a short time. 

6 Replies

  • TikiHardBop1's avatar
    TikiHardBop1
    Occasional Contributor

    OK, further data that may or may not clear things up. I'm having issues with it double-clicking on the same table. If you want to click on row 1, you have to do something like //tr[3]/td[1]/div, which leaves you kind of screwed if you have less than 3 rows. I tried using the test recorder when the table only has one row and it works, but when you look at the element that it is clicking on in the Namespace, you discover that it is actually the p-paginator at the bottom of the table! So maybe TestComplete has it's "aim" off for both the double-clicking and the context-menus. 

    I did notice that when it tries to right-click on a context menu item, sometimes you get that same menu that you get when you right click on a regular component. Curiouser and curiouser. 

  • Since recording work with XPath 

    //td[.="value from cell in table"] 

    and your XPath fails

    //p-contextmenu//li[@aria-label="Fred"]//span[@class="p-contextmenu-item-label"][.="Fred"] 

    can you update XPath to and try 

    //p-contextmenu//li[@aria-label="Fred"]//span[@class="p-contextmenu-item-label"]//[.="Fred"]

     

  • rraghvani's avatar
    rraghvani
    Icon for Champion Level 3 rankChampion Level 3

    There's a number of issues with the latest version of TestComplete (already discussed in the posts). I suggest you revert back to your previous working version of TestComplete, and log a support ticket of the issue.