Forum Discussion

shiva_ranabhat's avatar
shiva_ranabhat
Contributor
7 years ago

Cannot active the <item> in a Listbox - ClickItem("xyz") function suddenly stopped working?

Hi,

 

I have a piece of line that has been working for years and it has suddenly stopped working with no changes made to the script/application in that area. 

Using Jscript for Web application:

 

Page.NativeWebObject.Find("ObjectIdentifier", "ContentPlaceHolder1_Listbox_Roles").ClickItem("xyz");

 

This is giving me error message 'cannot activate the 'xyz' item.' during runtime.

 

The object spy cannot go inside the listbox (contentPlaceHolder1_Listbox_Roles), so that is last point of reference, I tried using other functions like SelectItem(xyz) or using full name or using different identifier or using test recorder etc.with no luck. I cannot use index (instead of name) as the item passed is a variable and will have different index on a different instance.  I think it is able to see the item, just cannot active it. 

 

Update: It is due to running the scripts in IE 11, previously it used to be ran on IE8/9.

 

Is there any workaround for this to work in IE 11?

 

Many Thanks,

Shiva

 

 

3 Replies

    • tristaanogre's avatar
      tristaanogre
      Esteemed Contributor

      With a browser update, there are all sorts of things that may have changed.  What you might want to take a look at is whether the identifying factors of your object have changed.  Currently, your find method is looking for one property with a particular property value. Is it possible that the value has changed so that it's no longer what it once was?  Can you post screenshots of your object properties?

      Also, is there a reason why you're using the NativeWebObject Find method and not the standard Find or FindChild that is off the object itself? 

       

      Also, with a change in browser, you might have to search a depth.. currently, you're only finding with the the first level of objects... it could be that the object you want may now actually be further down the hierarchy.

       

      Finally...  a "best practice" is that, rather than executing a method directly off the find, first find the object and assign it to a variable.  Next, detect whether the find was successful (variable contents are not NULL).  If the find was successful, THEN perform your click action.  

       

      These are where I would start... could be other things to check, but I'm always suspicious of object identification changes when a browser changes.

      • shiva_ranabhat's avatar
        shiva_ranabhat
        Contributor

        Hi Robert,

         

        The object identifiers haven't changed as far as I can see. It is able to find the object from the list below:

         

         

        I'm using property idStr and trying to click the second item in the list - AutoRole.

         

        I have used the Find method first, providing a Full Name of the object. Then assigned it to a variable, verified the find was successful and Perform Click action. 

         

        It is able to see AutoRole, but when executing the script, gets the error 'Cannot activate the 'AutoRole' item'.

         

        What would be the other things to be checked? or is there a way to perform click by wList(index) property?

         

         

        Best Regards,

        Shiva