When you put an element in properties as the target, it uses that element in the function as an argument for the element parameter. If you need something from your script like a variable to be passed into the function you insert that into the InputParameters field in the properties panel.
I didn’t have to put the id of the element as an input parameter because it was just a simple string, but I could have done it either way.
The problem I’m having I think is different than this now, but the answer to my original question would be,
Function(e){ return e.style.visibility; }
where as ‘e’ is the element I put in the Target Element Field.
I am still not getting any output for that.
But I was able to get all the innerHTML and that came out just fine.
I have my function working correctly now, and I’m able to output different attributes of the element, but for some reason I’m unable to output visibility or display.
It returns an empty string, which I believe means that attribute doesn’t exist for that element. What’s strange is that the javascript on the website I’m getting the element from changes the elements visibility, on the click of the button.
So why am I unable to retrieve it? I’m also unable to retrieve the zIndex. Empty strings. I need to have a way to check the web app to see if any of those <div id='messageAlert'> exist. Sometimes there are multiple divs on the screen, and each one needs to be handled accordingly in my switch statement based off of the title of the message alert.
The problem I’m running into is that when I run my Uipath script it finds the element even though it’s not visible. Because in CSS the object is still there, just not visible when the visibility property is toggled… Since it’s not returning those attributes to me, anyone have any ideas of how to accomplish this when I’m unable to retrieve those attributes?
Spoke to one of my tech leads and we figured it out. The visibility property, if it’s not initialized with anything, will return an empty string from the DOM. In the webpage the visibility property wasn’t set until the button was clicked. I ran another test where after I close the div, by clicking the button that invokes the function to set visibility to “hidden”, I then tried to retrieve the visibility attribute, and it did return “hidden”. Hope that ends up being useful for someone! Took me awhile to get down to the bottom of this one!