Search code examples
javascriptservicenowrpaautomationanywhere

Website Console Javascript > getElementsByName> Need defaultValue attribute returned


I am trying to get a unique identifier out of a ServiceNow webpage source code. I have identified where it is and I was hoping someone could help me to return the value that I need.

enter image description here

Here is an image of the attribute I would like returned.... any help would be appreciated. I am not familiar with JS so please forgive me if my terminology is not correct.

Then end goal is to take a baseURL and then add this string as a parameter to get the RPA software I am using to navigate to this page.

baseURL + defaultValue

I have tried many different combinations of document.querySelector and document.querySelectorAll

I am unfamiliar with js syntax so this is an uphill battle for me.


Solution

  • If I get you right, this can help you finding what you need:

    let myElement = document.getElementByName("sys_original.x_eyit2_dsr_dsr_task.dsr_case")
    
    let myDesiredValue = myElement[0].defaultValue
    
    console.log(myDesiredValue)
    

    What you are looking for is probably a JSON Object. I said "probably", because we don't have more details about your question.