JavaScript Issue - querySelector

I am not sure if I am writing this correctly or not but this is what I have, and I keep receiving an execution error (Unexpected token ‘}’)

WebUI.executeJavaScript("document.querySelector(g.graph).style.transform = 'matrix(.01,0,0,.01,0,0)',",null)

Any help would be greatly appreciated, newbie to all this stuff.

I don’t know what g.graph is, but the HTML DOM API querySelector() expects a valid CSS selector as a string.

Try:

String js = "document.querySelector(`valid CSS selector').style.transform = 'whatever'"
WebUI.executeJavaScript(js, null)

Why are you modifying style properties?

I have an NGX graph that I need to resize to fit elements into the viewport for katalon because if it is not literally visible then I cannot perform actions on the UI. I am at a loss.

That’s fair, though usually I’d insist you not change the AUT just for testing purposes.

So now all you need is a valid CSS selector. If you share the HTML, I’ll try to figure it out.

A post was split to a new topic: setText on field does not work

Try this code:

String js = "document.querySelector(`div.page ngx-graph[_ngcontent-fud-c900]').style.transform = 'scale(50%)'"
WebUI.executeJavaScript(js, null)

If _ngcontent-fud-c900 is dynamic, we might need something else.

I’ll move your other question to a new topic. It’s better for searchability to keep threads to a single topic.

Did it work?

Haven’t had the chance to try yet. Been working on passing variables…grrrrr… not having any fun with this at all.

Been watching this video over and over but no matter what I do I cannot get mine to work the way it does in this vid. Katalon Studio: Data Driven Testing: Executes Test Case with different data - YouTube

What I am currently tasked with doing takes priority and this is what I am trying to do but it doesnt work, and I’ve got everything set up manually in other cases and works without a hitch, but try to pass a variable from an excel and bam there goes the claymore.

‘’’
WebUI.setText(findTestObject(‘Object Repository/Global/FAM Global Search Input’), DISCRETE_JOB)

input_Value = WebUI.getAttribute(findTestObject(‘Object Repository/Global/FAM Global Search Input’), ‘value’)

WebUI.verifyMatch(DISCRETE_JOB, DISCRETE_JOB, false)

WebUI.sendKeys(findTestObject(‘Object Repository/Global/FAM Global Search Input’), Keys.chord(Keys.ENTER))

‘’’

You seem to be comparing a variable to itself. Are you trying to check if verifyMatch works?
Maybe you were thinking of:

WebUI.verifyMatch(input_Value, DISCRETE_JOB, false)

If you believe the above is correct, then you could try:

WebUI.verifyElementAttributeValue(findTestObject('Global/FAM Global Search Input'), 'value', "${DISCRETE_JOB}", 10)