Can I put a variable into a string?

two slashes?

image

Like I said…

1 Like
document.querySelector("#ext\\.sni\\.longDescription").value = "jess"
1 Like

Oh I retried the first one with double slashes and it printed jess

image

Cool.

It’s a good selector. Do you think your test code is trying to access the element too soon? Test Code is super quick. Browsers are dead slow.

1 Like

I’m not sure. I’ve left the window open from a previous run to just “run from here” on this one step to verify it’s visible (or present or anything) so I wouldn’t expect it needs any kind of wait since the page has been open for a while.

Hmm. Show me the code/steps.

image

I’ve got the relevant window open (by step 1) and am just right-clicking step 2, Run from here, and selecting that window.

And here’s the selector (I’ve tried with and without the “input” on there
image

Try wait instead of verify…

Make the timeout something like 5 or 10 seconds.

1 Like

I set it to 30 and had it run from the beginning, so a fresh browser but no dice

    Unable to wait for object 'Object Repository/Attribute/fieldLongDescription' to be visible (Root cause: com.kms.katalon.core.exception.StepFailedException: Unable to wait for object 'Object Repository/Attribute/fieldLongDescription' to be visible
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.stepFailed(WebUIKeywordMain.groovy:64)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:26)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain$runKeyword.call(Unknown Source)
	at com.kms.katalon.core.webui.keyword.builtin.WaitForElementVisibleKeyword.waitForElementVisible(WaitForElementVisibleKeyword.groovy:98)
	at com.kms.katalon.core.webui.keyword.builtin.WaitForElementVisibleKeyword.execute(WaitForElementVisibleKeyword.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:60)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.waitForElementVisible(WebUiBuiltInKeywords.groovy:434)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$waitForElementVisible$0.call(Unknown Source)
	at test.run(test:7)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
	at com.kms.katalon.core.main.ScriptEngine.runScriptAsRawText(ScriptEngine.java:119)
	at com.kms.katalon.core.main.TestCaseExecutor.runScript(TestCaseExecutor.java:337)
	at com.kms.katalon.core.main.TestCaseExecutor.doExecute(TestCaseExecutor.java:328)
	at com.kms.katalon.core.main.TestCaseExecutor.processExecutionPhase(TestCaseExecutor.java:307)
	at com.kms.katalon.core.main.TestCaseExecutor.accessMainPhase(TestCaseExecutor.java:299)
	at com.kms.katalon.core.main.TestCaseExecutor.execute(TestCaseExecutor.java:233)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:114)
	at com.kms.katalon.core.main.TestCaseMain.runTestCase(TestCaseMain.java:105)
	at com.kms.katalon.core.main.TestCaseMain$runTestCase$0.call(Unknown Source)
	at TempTestCase1575825521158.run(TempTestCase1575825521158.groovy:23)
Caused by: org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:13567
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
System info: host: 'T450S-W10-JPALM', ip: '192.168.148.20', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_181'
Driver info: driver.version: EventFiringWebDriver
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
	at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
	at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:19)
	at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:353)
	at org.openqa.selenium.remote.RemoteWebDriver.findElementsByCssSelector(RemoteWebDriver.java:424)
	at org.openqa.selenium.By$ByCssSelector.findElements(By.java:441)
	at org.openqa.selenium.remote.RemoteWebDriver.findElements(RemoteWebDriver.java:311)
	at org.openqa.selenium.support.events.EventFiringWebDriver.lambda$new$1(EventFiringWebDriver.java:105)
	at com.sun.proxy.$Proxy8.findElements(Unknown Source)
	at org.openqa.selenium.support.events.EventFiringWebDriver.findElements(EventFiringWebDriver.java:182)
	at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElements(WebUiCommonHelper.java:762)
	at com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement(WebUiCommonHelper.java:1109)
	at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword.findWebElement(WebUIAbstractKeyword.groovy:27)
	at com.kms.katalon.core.webui.keyword.internal.WebUIAbstractKeyword$findWebElement.call(Unknown Source)
	at com.kms.katalon.core.webui.keyword.builtin.WaitForElementVisibleKeyword$_waitForElementVisible_closure1.doCall(WaitForElementVisibleKeyword.groovy:79)
	at com.kms.katalon.core.webui.keyword.builtin.WaitForElementVisibleKeyword$_waitForElementVisible_closure1.doCall(WaitForElementVisibleKeyword.groovy)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
	at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain$runKeyword.call(Unknown Source)
	at com.kms.katalon.core.webui.keyword.builtin.WaitForElementVisibleKeyword.waitForElementVisible(WaitForElementVisibleKeyword.groovy:98)
	at com.kms.katalon.core.webui.keyword.builtin.WaitForElementVisibleKeyword.execute(WaitForElementVisibleKeyword.groovy:68)
	at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:60)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.waitForElementVisible(WebUiBuiltInKeywords.groovy:434)
	at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$waitForElementVisible$0.call(Unknown Source)
	at Script1575594800919.run(Script1575594800919.groovy:7)
	... 11 more
Caused by: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:13567
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:247)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:165)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
	at okhttp3.RealCall.execute(RealCall.java:77)
	at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:103)
	at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:155)
	at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
	... 34 more
Caused by: java.net.ConnectException: Connection refused: connect
	at okhttp3.internal.platform.Platform.connectSocket(Platform.java:129)
	at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:245)
	... 54 more

)

In terms of a wait-strategy, you should cluster all your waits into one block above your actionable steps:

// Do my waits...
WebUI.waitForElementVisible(...)
WebUI.waitForElementVisible(...)
WebUI.waitForElementVisible(...)
WebUI.waitForElementVisible(...)

// Do my actions...
WebUI.click(...)
//etc
1 Like

I usually do, this is just a dinky little test test case that I made to try to piece this out without the clutter of the other steps around it

That’s odd. That’s WebDriver complaining - little (or nothing) to do with your test step.

I tried again right after that and changed literally nothing about the object or the test steps and it started working! :eyes:

I finally figured out the verifying those elements were disabled too, after much trial and error!

WebUI.waitForElementVisible(findTestObject('Attribute/fieldLongDescription'), 15)

WebUI.waitForElementVisible(findTestObject('Attribute/stockUnitMeasure'), 15)

'Verify Long Description is not editable'
WebUI.verifyElementAttributeValue(findTestObject('Attribute/fieldLongDescription'), 'readonly', 'true', 15)

'Verify Stock Unit of Measure is not editable'
WebUI.verifyElementAttributeValue(findTestObject('Attribute/stockUnitMeasure'), 'disabled', 'true', 15, FailureHandling.STOP_ON_FAILURE)

:tada:

1 Like

Perhaps a driver was “stuck”? Katalon now has a way to kill drivers (although, when I tried it, it crashed Katalon).

Menu -> Tools -> Web -> Terminate running WebDrivers

I don’t know that was the issue, but “something” cleared the error and waiting around may have allowed it time to recover/reset itself.

1 Like

I just noticed that feature last night! I made my own driver killer .bat that I use periodically. I run all my scheduled Jenkins jobs locally so it’s a must have lol :sweat_smile:

hello I need your help now !! :face_with_monocle:

With what?