My question is how to obtain all the @onclick
properties on a page. I have tried the Get Element activity by XPath. When xpath = "//a"
, I can get the texts of all the links, but when xpath = "//a/@onclick"
, OpenRPA can’t find a single link, let alone @onclick
properties.
Openrpa can only find and handle elements.
But you can create and run your own logic using execute script.
Get element has no way of fetching onclick, its designed to DO the click, not enumerate different ways a click can be handled ( href,onclick,dom events etc )
try this:use attribute property of element variable
Elementvariable.Attributes(“@onclick”)
fi you want link of that tag it will be
Elementvariable.Attributes(“href”)
@yashshah Great. One more thing, how could I store those attributes? What type of variables should I use? It would be perfect if you could provide a demo. Thanks.
you can use object type variable and after that you can parse that to string , int32, datetime however you want.
@yashshah Can I use this variable later in the “Execute Script” activity?
I named this variable Links
. In the “Execute Script” editor, I first wrote
document.write("hi");
and the browser contained hi
solely. Then I changed it to
document.write(Links.toString());
but nothing happened.
No, sorry. But it’s called as a function, so if you use a return statement you can pick that up inside openrpa.
If you want to “send” something, you need to “hardcode” it into the script. So use a variable to contain your script and then concat your value(s) into the script. ( like in this example )
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.