ContributionsMost RecentMost LikesSolutionsRe: Covert some code from javascript to Groovy script I have tried but still not use Token is not fetch by using OAuth as that login site is 3 party application which dynamical changes Covert some code from javascript to Groovy script Working code in Groovy def handler = [(~/^Mac OS.*/) : { "open $it".execute() }, (~/^Windows.*/) : { "cmd /C start $it".execute() }, (~/.*/) : { //--- Open chrome in desktop machine def browsers =[ 'firefox'.'chrome' ] //--- find a browser we know the location of def browser = browsers.find { "which $it".execute().waitFor() == 0 } //--- and run it if one found if( browser ) "$browser $it".execute() } ] def k = handler.find { k, v -> k.matcher( System.properties.'os.name' ).matches() } k?.value( delegate ) } "URL".browse() Need to convert javascript to in groovy script document.getElementById("username-field").value = "UserName"; document.getElementById("password-field").value = "Password"; document.getElementById("login_submit").click(); console.log(localStorage.getItem("access_token")); SolvedRe: Covert some code from javascript to Groovy script Hi Karel, Yes. As in my case I have to take access token from UI, because of that I want to open application with credentials and then that generated token is store in localStorage of application and get that token from DOM.