Problem with SSN field


This pretty much guarantees there is a validator/event handler dealing with inputs to that field.

You could try sendKeys again using an ENTER key to commit the change or a TAB key to move away from the field and trigger onblur/onchange handling. You can use firefox to open the event handlers directly on the element. Here is a screenshot of this textarea on THIS PAGE - the one you’re reading - look at all the event handlers

thanks Russ for the reply. :slight_smile:
tried the above options but no luck…attaching the SS

Cool. Now post it again without the popup. I need to see the SSN input element.


String js = '''
  var ssn = document.querySelector('#SSN');
  ssn.value = "123456789";
WebUI.executeJavaScript(js, null)

If that doesn’t work:

String js = '''
  var ssn = document.querySelector('#SSN');
  ssn.value = "123456789";

Let me know how it goes.

Log viewer:
com.kms.katalon.core.exception.StepFailedException: Unable to execute JavaScript.
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)

console logs:
Caused by: org.openqa.selenium.JavascriptException: javascript error: ssn.onblur is not a function
(Session info: chrome=77.0.3865.75)
Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’
System info: host: ‘353799D’, ip: ‘’, ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’
Driver info: com.kms.katalon.selenium.driver.CChromeDriver
Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 77.0.3865.75, chrome: {chromedriverVersion: 77.0.3865.40 (f484704e052e0…, userDataDir: C:\Users\pkota\AppData\Loca…}, goog:chromeOptions: {debuggerAddress: localhost:14461}, javascriptEnabled: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, proxy: Proxy(), setWindowRect: true, strictFileInteractability: false, timeouts: {implicit: 0, pageLoad: 300000, script: 30000}, unhandledPromptBehavior: dismiss and notify}
Session ID: 1f731c5c51ce192762654615d2107fd4

Also i tried with the below as I am passing the value through excel sheet but still facing with the above error:

  • String js = ‘’
    var ssn = document.querySelector(’#SSN’)
    ssn.value = WebUI.setText(findTestObject(‘objectrepository/input_SSN_SSN’), findTestData(‘exceltestsuite’).getValue(15, rowNum))

    WebUI.executeJavaScript(js, null)/*

You’re making mistakes because you’re trying to run before you can walk.

Try the code that I gave you. Tell me what happens.

Try this in the browser console. Tell me what happens:

document.querySelector('#SSN').value = "123456789"

groovy.lang.MissingPropertyException: No such property: document for class: Script1568680728633

Please pay attention…

Try this in the browser console. Tell me what happens:

document.querySelector('#SSN').value = "123456789"

String js = ‘’’
document.querySelector(’#SSN’).value = “123456789”
WebUI.executeJavaScript(js, null)

tried with the above code and it is inserting without dashes in the SSN field

Now this:

document.querySelector('#SSN').value = "123456789"; document.querySelector('#SSN').onblur()

I’m hoping to see the dashes being applied. Either way, this proves you can assign the field with JavaScript. The original code I gave you should work, too. But DON’T add your stuff yet.

I’m stepping out - I’ll be gone a couple hours.

sure…i dont until you confirm.

still no dashes with the above code.

I’m winging this based on your earlier attempts:

String ssnvalue = findTestData('exceltestsuite').getValue(15, rowNum)
String js = """
  var ssn = document.querySelector('#SSN');
  ssn.value = '${ssnvalue}';
WebUI.executeJavaScript(js, null)

You can also try ssn.onchange() instead of onblur(). If you’re convinced that something in the code makes the dashes appear, one or other of the events you saw listed in the popup MUST be doing it - you just need to find which one.

If you cannot get this block of code to work, then you should go back to using sendKeys (I still think that’s your best option).

tried with the above code and used the other events as well. SSN is printing in the test box now with dashes but failing. here are the logs
unable to execute java script

onchange/onblur/unmask…is not a function

info:added the import org.openqa.selenium.JavascriptExecutor package but facing with the same error

Try .blur() instead of .onblur()

In future, PASTE the WHOLE error. You can of course strikeout anything you consider sensitive or private.

and kindly use code formating. is not that hard to add three backticks above & after the code/log sample
LE: or just a backtick for inline commands

1 Like


Please understand, the root problem is actually trivial. Solving it is proving difficult due to lack of adherence to the best advice given below. If this continues, I’m going to back off – which is NOT what I want to do or what we do around here. We like to help.

Study this and please adopt the advice:

1 Like

adding to this:
… please have in mind that we do this in our free time.
we have also families, jobs and so on.
so … help us to help you :slight_smile:


Highlight the SSN field in the Inspector (Firefox, please). Then try these again in the browser console. You should see output VERY similar.

You enter everything after each >>


onchange does not exist (null), but blur and onblur do exist (functions that return undefined).

thanks alot Russ for your support. its working fine now after removed the ssn.onblur(); line.

1 Like