Get Attribute (Hyperlink)

Hi Folks,

I am trying to use Get Attribute activity to get the url from a hyperlink.

However, it seems as the site was developed with js and actual url is not shown but just #. any idea how to go about this?

<a href="#" style="" type="link" onclick="mojarra.jsfcljs(document.getElementById('content'),{'content:j_idt814:j_id29: ProgressDT:j_id34-0':'conten:j_idt814:j_id29: ProgressDT:j_id34-0'},'_blank');return false" class="commandLink_MAIN">XXXXXXX</a>

Thanks in advance!

Rgs,
Jack

@robot_learner

Check below for your reference

Hope this may help you

Thanks

How to go about what? Do you just need to get the URL, or do you need to browse to the URL?

Hi @postwick ,

Get the URL. However, as u can see, the url is only generated upon ‘onclick’.

Currently, ‘Get Attribute’ with ‘href’ only returns me ‘#’ which is not useful to me.

Hope it clarifies.

Hi @Srini84

Let me try it out! Thx!

if you just want to navigate to the hyperlink without using uipath to click it you can use inject js activity where the js file is a text file e.g. test.txt containing this:

function(e){
mojarra.jsfcljs(document.getElementById('content'),{'content:j_idt814:j_id29: ProgressDT:j_id34-0':'conten:j_idt814:j_id29: ProgressDT:j_id34-0'},'_blank');return false;
}

image
in the inject js activity you also have to indicate an element inside the browser so that uipath knows where to target the JS

1 Like

Hi @jack.chan

Thanks for sharing! Let me try this out.

Between, as the content details will always changes, i.e. content:j_idt814 can be content:j_idt900 the next time, any idea how to go about w/o ‘hardcoding’ the js file?

Thanks!

then it definitely needs to change, instead of using onclick() can try to use other properties that are fixed such as the class name / inner text etc. Is your link always in a fixed position?

if you are using chrome can you right click the page and click “view page source” and then upload the html source here?