Forum Discussion

lokithorshield's avatar
lokithorshield
Contributor
10 years ago

Unable to identify an Element

Hi within some expanding panels I am trtying to verify if a panel is expanded.

* I am unable to identify conclusively for both of them.

* XPath is not working as before and after expanding xpath is same.

* Contenttext is not working reliably ?

                          I used Page.Find("contentText","*xxxx*"), worknig for before and after. 

                          I used Page.Find("contentText","xxxx"), its not at all finding. 

 

When Expanded
<div data-dojo-attach-point="titleWrapper" class="dojoxExpandoTitle"><div class="dojoxExpandoIcon dojoxExpandoIconLeft" role="button" tabindex="0" title="Click to Collapse" data-dojo-attach-point="iconNode" data-dojo-attach-event="ondijitclick:toggle" aria-controls="xxx_widget_ExpandoPane_2"><span class="a11yNode">X</span></div><span class="dojoxExpandoTitleNode" data-dojo-attach-point="titleNode">New Lookup</span></div>

When Not Expanded
<div class="dojoxExpandoIcon dojoxExpandoIconLeft" role="button" tabindex="0" title="Click to Expand for New Lookup" data-dojo-attach-point="iconNode" data-dojo-attach-event="ondijitclick:toggle" aria-controls="xxx_widget_ExpandoPane_2"><span class="a11yNode">X</span></div>

 

 

2 Replies

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Loki,

    To search through the HTML content, you can use the EvaluateXPath or FindChildByXPath method. Refer to the "Finding Web Objects Using XPath Expressions" ( http://smartbear.com/viewarticle/62117/ ) help topic for details. For example, here is the code to identify the expanded block:

       

    'VBScript
    arr = page.EvaluateXPath("//DIV[contains(@title, 'Click to Collapse')]")
    ' Check the result 
    If Not IsNull(arr) Then 
      ' The block was expanded
      'Perform some clicks
    Else 
      'The block wasn’t expanded
    End If 

     

    • lokithorshield's avatar
      lokithorshield
      Contributor

      Hi Tanya,  yes I am able to do that already - but here the oddity is that one of them should be found if click action is done. else other should be found. - Among [Click to collapse] and [Click to Expand].

       

      However - I am able to find both xpaths after page initial load. So My verification, if, Only one of the panel is available during initial default page load, actually fails. [Rather incorrectly passes]

       

      Thanks,

      Mahesh