Find the link inside a table

The HTML fragment range you provided is too narrow. I can not see how your HTML is coded. Could you show me all the ancestor nodes of the ?

<html><body>
  ...  <sometag id="sSelectCal">
    ????
       <option selected="selected" value="11-2018">November 2018 </option>

please show me the ??? part.

Ok the upper side of the code is like this one:

June 2018 July 2018

I made a HTML like this:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Discussion #7278</title>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="">
<!--[if lt IE 9]>
<script src="//cdn.jsdelivr.net/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
<link rel="shortcut icon" href="">
</head>
<body>
<!-- Place your content here -->
<div style="background-color:grey">
    <select id="sSelectCal" style="WIDTH: 185px" align="CENTER" valign="MIDDLE" 
        class="gridval" name="sSelectCal"
        onchange="Javascript:ReturnCalendar(); return false;">
        <option value="6-2018"> June 2018 </option>
        <option value="7-2018"> July 2018 </option>
        <option value="10-2018"> October 2018 </option>
        <option selected="selected" value="11-2018">November 2018 </option>
    </select>
</div>
<!-- SCRIPTS -->
<!-- Example: <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> -->
</body>
</html>

I made a Test Object named ‘Page_Discussion 7278/sSelectCal_option_selected’ with selector by XPath:

//select[@id="sSelectCal"]/option[@selected]

I made a Test Case as follows:

import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.model.FailureHandling as FailureHandling
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI
WebUI.openBrowser('')
WebUI.navigateToUrl('http://demoaut-mimic.kazurayam.com/7278_testbed.html')
WebUI.verifyElementPresent(findTestObject('Page_Discussion 7278/sSelectCal_option_selected'), 10, FailureHandling.STOP_ON_FAILURE)
def monthContent = WebUI.getText(findTestObject('Page_Discussion 7278/sSelectCal_option_selected'))
def monthValue = WebUI.getAttribute(findTestObject('Page_Discussion 7278/sSelectCal_option_selected'), 'value')
WebUI.comment("selected month is ${monthContent} (value=${monthValue})")
WebUI.closeBrowser()

When I execute the test case, I got the following output in the log:

selected month is November 2018 (value=11-2018)

I think this is what you want.

@4280-kazurayam

This is slightly off-topic, but is it possible to parameterize the test object without using the Object Repository?
Can I just create new test object in memory?

Mate Mrse said:

@4280-kazurayam

This is slightly off-topic, but is it possible to parameterize the test object without using the Object Repository?
Can I just create new test object in memory?

Mate,

I think it is possible. The key technique would be using **groovy.text.SimpleTemplateEngine
**

I will try to make a demo later.

Mate,

What is your problem (use case)? Why do you want to find a way to parameterize the test object without using the Object Repository? — I personally do not have this sort of problem in mind, so that I am uncertain how my demo project should be like. Could you share your target HTML here and describe what you want to do? Even more, would you raise another post, as it would be off-topic.

Mate,

I have made a demo of “Parameterized Test Object on the fly”. See

1 Like

Thank you, Kazurayam!

What I wanted to do is: I have a web form with multiple radio button columns with different options to check or uncheck. So, instead of creating 10 different test objects, I will now need to make one and parametrize it.

Thanks again!