Forum Discussion

vijayakrishnabv's avatar
vijayakrishnabv
Occasional Contributor
6 months ago
Solved

Xpaths provided in Namemapping not getting recognized when correct Xpath is not the first one

Hi,

I have below Namemapping & when provided first xpath is not correct, TestComplete not identifying object based on the second or subsequent matching xpath.

Can you please help?

 

 

  • Thank you all for your time.

    Issue got resolved by using below in namemapping as per our DOM structure:

    //iframe[contains(@id,'frame')][contains(@style,'height')]

12 Replies

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    idStr = "_iframe2" should match the xpath //iframe[@name='_iframe2'] ?

  • vijayakrishnabv's avatar
    vijayakrishnabv
    Occasional Contributor

    iframe number is getting changed dynamically and when we used regular expression or more than one xpath by having 1 and 2 separately, iframe not getting identified. 

  • vijayakrishnabv's avatar
    vijayakrishnabv
    Occasional Contributor

    Also when we provide multiple xpaths, why TestComplete is not taking up any one of the matched Xpath. Is there any reason?

    • eykxas's avatar
      eykxas
      Frequent Contributor

      Hi! 

       

      In my project I faced the same issue, so I develop my own method to do multi xpath.

    • vijayakrishnabv's avatar
      vijayakrishnabv
      Occasional Contributor

       

      Hi, Observed that we have 2 frames and objects are getting loaded under any one of the 2 frames. So we are able to write code to identify the relevant frame by using childCount.

      Is there a way to perform the same using Namemapping?, Because this is the new design of existing page and we need to update existing Namemapping.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    A child node needs to have a parent. Does the child node belong to _iframe1 or _iframe2?

    • vijayakrishnabv's avatar
      vijayakrishnabv
      Occasional Contributor

      Thank you all for your time.

      Issue got resolved by using below in namemapping as per our DOM structure:

      //iframe[contains(@id,'frame')][contains(@style,'height')]

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    So contains works as suggested? Not sure why you are using height

    • vijayakrishnabv's avatar
      vijayakrishnabv
      Occasional Contributor

      Webpage has 2 iFrames & all the controls are getting loaded either under iframe1 or iframe2 dynamically.

      Earlier also I was using contains and was not getting identified particular iframe where controls are loaded. We identified that height is one additional tag getting displayed when controls are getting loaded under specific iframe.

      Appreciate your help Raghavan.