Multiple Compilation Errors Exception when used 'Run from here' option

Hi there,

In my Testcase I am extracting a list of values from the dropdown of my UI page, for that am using the below code.

WebUI.click(findTestObject('Program/Page_Identifi - Patient Home/span_Select Program Name'), FailureHandling.CONTINUE_ON_FAILURE)

List<String> PgmList = WebUiCommonHelper.findWebElements(findTestObject('Object Repository/anyDropDownList'),
	30)

int totPgms = PgmList.size()

The code works fine when I run it from start but when I use Run from here option to run my testcase from half way it is throwing me below error

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script1614598628034.groovy: 174: unable to resolve class WebElement
@ line 174, column 6.
List PgmList = WebUiCommonHelper.findWebElements(findTestObject(‘Object Repository/CM/anyDropDownList’), 30)
^

Could you please suggest on the issue?

Just a note that your code and the error do not reflect the same element. The pathway of your element in the error message has the extra folder, CM, in it.

Object Repository**/CM/**anyDropDownList

thats right… It was removed by mistake. This is correct path

WebUI.click(findTestObject('Program/Page_Identifi - Patient Home/span_Select Program Name'), FailureHandling.CONTINUE_ON_FAILURE)

List<String> PgmList = WebUiCommonHelper.findWebElements(findTestObject('Object Repository/CM/anyDropDownList'),
	30)

int totPgms = PgmList.size()```

Code is running successfully when ran from start. I made No changes to the code
image

Any update on the issue? Is it a issue with Katalon tool?

When you use “Run from here”, KS ignores everything above that line. When I use it, I get the problem of my Global Variables not being defined as I do that in a routine at the start of the TC. My thinking is you may have a problem with the definition of “WebUiCommonHelper” (or another reference) which is probably defined earlier in your TC. Maybe one of the Forum Moderators will have a better answer.

@grylion54 @kazurayam
I have following steps in my test case.

  1. Login to the Application
  2. Locate the patient
  3. initialize excel sheet and extract the data into Arraylist
  4. Navigate to the module on the webage
  5. click on the required object and retrieve dropdown list from UI(the step which I pasted above)
  6. here there validation present

All I am doing is When I run my test at second time, am ignoring first step and restarting my execution from step 2. Then also am getting above issue mentioned

This line looks strange to me.

WebUiCommonHelper.findWebElements returns List<WebElement>, not List<String>.

Possibly you want to add an import statement for the class WebElement

import org.openqa.selenium.WebElement

“at first time” and “at second time” — how can your test case script differentiate these 2 cases?
If you run the script for the 3rd time, how do you want your test case script to behave? Do you want it to do “1. Login to the Application” or not?

Thanks @kazurayam its working now. I had done ctr+shift+o so thought these is no issue with libraries as such

@kazurayam
I mean to say when I run my test case for the first time means I click on run button at the top so it executes all the steps from my test case
When I run for the second time meaning I manually right click on the Step and click on ‘Run from here’ in order save time to login in to application everytime

It was giving me error when I used ‘Run from here’ option

Thanks to you it is working now

Then, you are happy now? May I close this issue?

Sure!
Please close it :slight_smile: