Xpath in groovy script

Hi,
can you please suggest how to code the xpath in the coding of groovy script. For example…if we want to enter the text in the text box, what would be the syntax for this.

WebUI.setText() ??

Please suggest.

You can use a Test Object to store your xpath:

https://docs.katalon.com/katalon-studio/docs/manage-test-object.html#create-a-test-object

in which case you would utilize the WebUI methods as you’ve suggested.

Another way is to use the WebUiCommonHelper methods to convert everything to WebElements and use Selenium as usual:

WebElement textArea = WebUiCommonHelper.findWebElement(By.xpath(“//textarea[@id=‘some_id’]”));
textArea.sendKeys(“xyz”);

You can also create and use Test Objects programmatically in your script:

Thanks for your reply.
I wanted to use it in property name in the web application is very lengthy. So, i wanted to use xpath in the scripting for drop down.

To select the value from the drop down, how to code in the script. I want to select the property and select the value from the drop down. For this, I need the example syntax to code it.

I tried this option and it is not working. Below is the code that I have tried with.
WebElement textArea = WebUICommonHelper.findWebElement(By.xpath(“//select[@id=‘service_type_code’]”))
textArea.select(“AUDIO CONFERENCING (MAC)”)

Below is the html code for the same. I need to select the service_type_code value as
AUDIO CONFERENCING (MAC) from the drop down list.

Please share the syntax how to code this.

<html lang=“en”>
<head>

<title>Create Dispute </title>
<link rel=“stylesheet” type=“text/css” href="?appId=gmpdispute&amp;flName=/uitmpl/en/css/uitmpl.css" />
<link rel=“stylesheet” type=“text/css” href="?appId=gmpdispute&amp;flName=/gdp/css/gdp.css" />
<script type=“text/javascript” src="?appId=gmpdispute&amp;flName=/uitmpl/js/other_scripts.js"></script>
<script type=“text/javascript” src="?appId=gmpdispute&amp;flName=/uitmpl/js/freezingHeader.js"></script>

<noscript>
<style>
table.mQH {display:block;}
</style>
</noscript>
<style id=“antiClickjack”>body{display:none !important;}</style>
<script type=“text/javascript”>
if (self === top) {
var antiClickjack = document.getElementById(“antiClickjack”);
antiClickjack.parentNode.removeChild(antiClickjack);
} else {
top.location = self.location;
}
</script>
</head>
<body onload=“uitmpl_qhPageInit();registerOnchangeEvent();”>

<!-- Skip To Main Content should be the next element immediately after body element -->
<div class=“skipnav”><a href="#maincontent" title=“Skip to Main Content”>Skip to Main Content</a> </div>

<script type=“text/javascript” src="?appId=gmpdispute&amp;flName=/uitmpl/js/menu_script.js"></script>
<script type=“text/javascript” src="?appId=gmpdispute&amp;flName=/uitmpl/js/application_settings.js"></script>
<script type=“text/javascript” src="?appId=gmpdispute&amp;flName=/uitmpl/js/global_settings.js"></script>

<script type=“text/javascript”>
application.data = {
td_1: “Home”,
td_2: “Govt Dispute”,
td_3: “Create Disputes”,
td_4: “Reports/Search”,
td_5: “My Preference”,

url_1: “javascript:OnGMPPortalSubmit(document.frmMenuScr, ‘’)”,
url_2: “javascript:OnMenuSubmit (document.frmMenuScr, ‘homepage’)”,
url_3: “javascript:OnMenuSubmit (document.frmMenuScr, ‘disputesubmenu’)”,
url_4: “javascript:OnMenuSubmit (document.frmMenuScr, ‘reportLink’)”,
url_5: “javascript:OnMenuSubmit (document.frmMenuScr, ‘userpref’)”

};

global.data = {
//td_1: “AT&amp;T BusinessDirect”,
td_1: “Write Us”,
td_2: “Help<span class=“offscrn”> - Opens a PDF Document for Help</span>”,
td_3: “Close”,
//td_3_1: “General Help”,
//td_3_2: “Application Tutorial”,
//td_3_3: “<span id=“shHd”>Show</span> Quick Help”,
//url_1: “javascript:bizDirect()”,
url_1: “javascript:OnMenuSubmit(document.frmMenuScr, ‘compose’)”,
url_2: “javascript:uitmpl_popUpReg(document.frmMenuScr.action + ‘?appId=’ + document.frmMenuScr.appId.value + ‘&flName=’ + document.frmMenuScr.context.value + ‘/help/Disputes_UG.pdf’)”,
url_3: “javascript: window_close(document.frmMenuScr, ‘logoff’);”
//url_3_1: “javascript:uitmpl_popUpReg(document.frmMenuScr.action + \’?appId=\’ + document.frmMenuScr.appId.value + \’&flName=\’ + document.frmMenuScr.context.value + \’/help/Disputes_UG.pdf\’)”,
//url_3_2: “#”,
//url_3_3: “javascript:uitmpl_qhPageToggle()”
};
</script>

<script type=“text/javascript” src="?appId=gmpdispute&amp;flName=/gdp/js/script.js"></script>

<!–************ uitmplbegin: tBAN ******–>
<!–
begin:background graphic ******–>

<table width=“100%” cellspacing=“0” border=“0” class=“tBAN”>

<tr>
<td><img src="?appId=gmpdispute&amp;flName=/uitmpl/en/img/swoosh.gif" width=“650” height=“69” alt="" border=“0” /></td>
</tr>
</table>
<!–****** end:background graphic –>
<!–
begin:logo and company title ******–>
<div class=“logoCompany”>
<table width=“100%” cellspacing=“0” border=“0” class=“tBAN”>

<tr>
<td class=“logo”><img src="?appId=gmpdispute&amp;flName=/uitmpl/en/img/attbizdirect.gif" width=“291” height=“63” alt=“AT&T Business Direct” border=“0” /></td>
<td><!-- stretchable cell --></td>
<!-- max characters for company title: 72 w/ breaks (24 per line) -->
<td class=“company”>ATT Gov Sol Dev<br/>rm0013<br /></td>
</tr>
</table>
</div>

<!–****** end:logo and company title –>
<!–
begin:application title –>
<table cellspacing=“0” border=“0” class=“appTitle”>
<tr>
<td><a href=“javascript:OnMenuSubmit (document.frmMenuScr, ‘homepage’)”>View and Analyze Govt. Bills: Govt Dispute</a></td>
</tr>
</table>
<!–
end:application title ******–>

<!–************ uitmplend: tBAN –>
<!–
uitmplbegin: tNAV ************–>
<div id=“glbl”>
<script language=“JavaScript1.3”>
<!–
uitmpl_list(“global”);
//–>
</script>
<noscript>
<div class=“globalAcc”>
<table class=“global_main” cellspacing=“0” border=“0”>
<tr>
<td class=“global_main_spacer”>&nbsp;</td>
<td><a href=“javascript:bizDirect()”>AT&amp;T BusinessDirect</a></td><td class=“pipe”> </td><td><a href=“javascript:OnMenuSubmit(document.frmMenuScr, ‘compose’)” target="_new">Write Us</a></td><td class=“pipe”> </td><td><a href="#">Help</a></td>
</tr>
</table>
</div>
</noscript>
</div>
<div id=“app”>
<script language=“JavaScript1.3”>
<!–
uitmpl_list(“application”);
//–>
</script>
<noscript>
<div class=“applicationAcc”><table class=“application_main” cellspacing=“0” border=“0”>
<tr>
<td><a href=“javascript:OnMenuSubmit (document.frmMenuScr, ‘homepage’)”>Home</a></td>
<td class=“pipe”> </td>
<td><a href=“javascript:alert (‘Under Construction…’)”>Create/Update Dispute</a></td>
<td class=“pipe”> </td>
<td><a href=“javascript:alert (‘Under Construction…’)”>Reports/Search</a></td>
<td class=“pipe”> </td>
<td><a href=“javascript:OnMenuSubmit (document.frmMenuScr, ‘UserPreference’)”>My Preference</a></td>
<td class=“pipe”> </td>
<td><a href=“javascript:alert (‘Under Construction…’)”>User Management</a></td>
</tr>
</table>
</div>
</noscript>
</div>

<!–************ uitmplend: tNAV –>
<form name=“frmMenuScr” action="/servlet/GMPGate" method=“get”>
<input type=“hidden” name=“appId” value=“gmpdispute”>
<input type=“hidden” name=“nextScr” value=“userpref”>
<input type=“hidden” name=“contract_grp” value="">
<input type=“hidden” name=“methodToCall” value=""/>
<input type=“hidden” name=“sys_tracking_nbr” value=""/>
<input type=“hidden” name=“context” value="/gdp"/>
<input type=“hidden” name=“from” value=""/>
<!-- <a name=“maincontent” id=“maincontent” tabindex="-1" ></a> -->
</form>
<!–
begin:grid –>
<table width=“50%” cellspacing=“0” border=“0” class=“wrap”>
<tr>
<td width=“100%” class=“grid”>
<!-- InstanceBeginEditable name=“PageHeader” -->
<!–
uitmplbegin: tPH –>
<!–
begin:titles –>
<table cellspacing=“0” border=“0” class=“tPH”>
<!–
begin:page title –>
<tr>
<td><h4 class=“pgTitle”><a name=“maincontent” id=“maincontent” tabindex="-1"></a>Create Dispute </h4></td>
</tr>
<!–
end:page title –>
</table>
<!–
end:titles –>
<!–
uitmplend: tPH ************–>
<!-- InstanceEndEditable -->
<!-- start error part -->

<!— BeginOptional name=“DataEntryEdit” —>
<!-- InstanceBeginEditable name=“DataEntryEdit” -->
<!–************ uitmplbegin: mUI ************–>

<form name=“disputeForm” action="/servlet/GMPGate" enctype=“multipart/form-data” method=“POST”>
<input type=“hidden” name=“appId” value=“gmpdispute”>
<input type=“hidden” name=“nextScr” value=“dispute”>
<input type=“hidden” name=“fieldFocus” id=“fieldFocus” value="">
<input type=“hidden” name=“from” value="">
<input type=“hidden” name=“methodToCall” value=“create”>
<input type=“hidden” name=“oldMethodToCall” value="">
<input type=“hidden” name=“sys_tracking_nbr” value="">
<input type=“hidden” name=“disp_srce_code” value=“3”>
<!-- start data entry part -->

<table cellspacing=“0” border=“0” class=“mDL”>
<!–****** begin:instructional text ******–>

<tr>
<td class=“required” >&nbsp;</td>
<td class=“required”>*</td>
<td colspan=“8” width=“100%”>Indicates required data input fields</td>
</tr>
<tr>
<td class=“required” >&nbsp;</td>
<td class=“required”><!-- * --></td>
<td colspan=“8” width=“100%”>&nbsp;</td>
</tr>

<!–****** end:instructional text –>
<!–
begin:basic fields ******–>

<td class=“label” >&nbsp;</td>
<td class=“label” ><labels class=“required”></label></td>
<td class=“label” nowrap>
<label for=“contract_nbr” class=“abled”>
<!-- * -->
Contract Number :

</label>
</td>
<td align=“left” width=“12” nowrap>
<a id=“qhtxt_h_contract_nbr” href=“javascript:uitmpl_qhelp(‘h_contract_nbr’,‘qhdisp_h_contract_nbr’);” tabindex="-1"><img src="?appId=gmpdispute&amp;flName=/uitmpl/en/img/quickhelp_dk.gif" id=“qh_img” width=“12” height=“12” alt=“Quick Help-Contract Number” border=“0” /></a>
</td>
<td colspan=“6” class=“value” width=“500”>

<input type=“text” name=“contract_nbr” maxlength=“15” size=“22” tabindex="-1" value=“GS00T07NSD0007” readonly=“readonly” id=“contract_nbr” title="">

</TD>
</TR>

<td class=“label” >&nbsp;</td>
<td class=“label” ><labels class=“required”></label></td>
<td class=“label” nowrap>
<label for=“ttl_short_desc_text” class=“abled”>
*
Title :

</label>
</td>
<td align=“left” width=“12” nowrap>
<a id=“qhtxt_h_ttl_short_desc_text” href=“javascript:uitmpl_qhelp(‘h_ttl_short_desc_text’,‘qhdisp_h_ttl_short_desc_text’);” tabindex=""><img src="?appId=gmpdispute&amp;flName=/uitmpl/en/img/quickhelp_dk.gif" id=“qh_img” width=“12” height=“12” alt=“Quick Help-Title” border=“0” /></a>
</td>
<td colspan=“6” class=“value” width=“500”>

<input type=“text” name=“ttl_short_desc_text” maxlength=“150” size=“80” tabindex="" value="" id=“ttl_short_desc_text” title="">

</TD>
</TR>

<td class=“label” >&nbsp;</td>
<td class=“label” ><labels class=“required”></label></td>
<td class=“label” nowrap>
<label for=“disp_case_status_code” class=“abled”>
<!-- * -->
Status :

</label>
</td>
<td align=“left” width=“12” nowrap>
<a id=“qhtxt_h_disp_case_status_code” href=“javascript:uitmpl_qhelp(‘h_disp_case_status_code’,‘qhdisp_h_disp_case_status_code’);” tabindex="-1"><img src="?appId=gmpdispute&amp;flName=/uitmpl/en/img/quickhelp_dk.gif" id=“qh_img” width=“12” height=“12” alt=“Quick Help-Status” border=“0” /></a>
</td>
<td colspan=“6” class=“value” width=“500”>

<select name=“disp_case_status_code” tabindex="-1" id=“disp_case_status_code” title=“Status”><option value=“OPEN” selected=“selected”>OPEN</option></select>

<input type=“hidden” name=“disp_case_status_code” value=“OPEN”>

</TD>
</TR>

<td class=“label” >&nbsp;</td>
<td class=“label” ><labels class=“required”></label></td>
<td class=“label” nowrap>
<label for=“ahc_code” class=“abled”>
*
AHC :

</label>
</td>
<td align=“left” width=“12” nowrap>
<a id=“qhtxt_h_ahc_code” href=“javascript:uitmpl_qhelp(‘h_ahc_code’,‘qhdisp_h_ahc_code’);” tabindex=""><img src="?appId=gmpdispute&amp;flName=/uitmpl/en/img/quickhelp_dk.gif" id=“qh_img” width=“12” height=“12” alt=“Quick Help-AHC” border=“0” /></a>
</td>
<td colspan=“6” class=“value” width=“500”>

<input type=“text” name=“ahc_code” maxlength=“28” size=“40” tabindex="" value="" id=“ahc_code” title="">

<input type=“button” class=“buttonExtraSmall” value=“Submit AHC” title=“Submit AHC” onclick=“setFocus(‘ahc_code’);javascript:this.value=this.value.toUpperCase();this.form.nextScr.value=‘setupdispute’;if (this.form.methodToCall.value != ‘refresh’) this.form.oldMethodToCall.value=this.form.methodToCall.value;this.form.methodToCall.value=this.form.oldMethodToCall.value;this.form.submit()” onkeypress=“if(chkKey(event)){setFocus(‘ahc_code’);javascript:this.value=this.value.toUpperCase();this.form.nextScr.value=‘setupdispute’;if (this.form.methodToCall.value != ‘refresh’) this.form.oldMethodToCall.value=this.form.methodToCall.value;this.form.methodToCall.value=this.form.oldMethodToCall.value;this.form.submit()}”>

</TD>
</TR>

<td class=“label” >&nbsp;</td>
<td class=“label” ><labels class=“required”></label></td>
<td class=“label” nowrap>
<label for=“service_type_code” class=“abled”>
*
Service Type :

</label>
</td>
<td align=“left” width=“12” nowrap>
<a id=“qhtxt_h_service_type_code” href=“javascript:uitmpl_qhelp(‘h_service_type_code’,‘qhdisp_h_service_type_code’);” tabindex=""><img src="?appId=gmpdispute&amp;flName=/uitmpl/en/img/quickhelp_dk.gif" id=“qh_img” width=“12” height=“12” alt=“Quick Help-Service Type” border=“0” /></a>
</td>
<td colspan=“6” class=“value” width=“500”>

<select name=“service_type_code” tabindex="" id=“service_type_code” title=“Service Type”><option value="">Make a Selection</option>

<option value=“RAV”>ANTI-VIRUS MANAGEMENT (RAV)</option>
<option value=“CAT”>ASYNCHRONOUS TRANSFER MODE (CAT)</option>
<option value=“MAC”>AUDIO CONFERENCING (MAC)</option>
<option value=“MCC”>CALL CENTER/CUSTOMER CONTACT CENTER (MCC)</option>
<option value=“WCP”>CELLULAR/PERSONAL COMMUNICATIONS (WCP)</option>
<option value=“CSD”>CIRCUIT SWITCHED DATA (CSD)</option>
<option value=“MCS”>COLLABORATION SUPPORT (MCS)</option>
<option value=“MCL”>COLLOCATED HOSTING (MCL)</option>
<option value=“COM”>COMBINED (COM)</option>
<option value=“CTS”>COMMUNICATIONS TRANSPORT SERVICES (CTS)</option>
<option value=“ICD”>CONTENT DELIVERY NETWORK (ICD)</option>
<option value=“ICI”>CONVERGED IP (ICI)</option>
<option value=“MSD”>CUSTOMER SPECIFIC DESIGN AND ENGINEERING (MSD)</option>
<option value=“ODF”>DARK FIBER (ODF)</option>
<option value=“MDH”>DEDICATED HOSTING (MDH)</option>
<option value=“CEN”>ETHERNET (CEN)</option>
<option value=“SFS”>FIXED SATELLITE (SFS)</option>
<option value=“CFR”>FRAME RELAY (CFR)</option>
<option value=“GEP”>GENERAL PRICING (GEP)</option>
<option value=“GPR”>GENERAL PRICING (GPR)</option>
<option value=“RIR”>INCIDENT RESPONSE (RIR)</option>
<option value=“IIP”>INTERNET PROTOCOL (IIP)</option>
<option value=“RID”>INTRUSION DETECTION (RID)</option>
<option value=“IPS”>IP BASED SERVICES (IPS)</option>
<option value=“IIT”>IP TELEPHONY (IIT)</option>
<option value=“SLM”>LAND MOBILE RADIO (SLM)</option>
<option value=“ILV”>LAYER 2 VPN (ILV)</option>
<option value=“RME”>MANAGED E-AUTHENTICATION (RME)</option>
<option value=“RMF”>MANAGED FIREWALL (RMF)</option>
<option value=“MNT”>MANAGED NETWORK (MNT)</option>
<option value=“RMT”>MANAGED-TIERED SECURITY (RMT)</option>
<option value=“MAS”>MANAGEMENT &amp; APPLICATION SERVICES (MAS)</option>
<option value=“SMS”>MOBILE SATELLITE (SMS)</option>
<option value=“WMM”>MULTIMODE WIRELESS LAN (WMM)</option>
<option value=“INB”>NETWORK-BASED IP VPN (INB)</option>
<option value=“OBS”>OPTICAL BASED SERVICES (OBS)</option>
<option value=“OWL”>OPTICAL WAVELENGTH (OWL)</option>
<option value=“IPB”>PREMISES-BASED IP VPN (IPB)</option>
<option value=“CPL”>PRIVATE LINE (CPL)</option>
<option value=“RSM”>SECURE MANAGED E-MAIL (RSM)</option>
<option value=“RTS”>SECURITY SERVICES (RTS)</option>
<option value=“SPS”>SPECIAL SERVICES (SPS)</option>
<option value=“MSS”>STORAGE (MSS)</option>
<option value=“OSN”>SYNCHRONOUS OPTICAL NETWORK (OSN)</option>
<option value=“MTW”>TELEWORKING (MTW)</option>
<option value=“CTF”>TOLL-FREE (CTF)</option>
<option value=“MUM”>UNIFIED MESSAGING (MUM)</option>
<option value=“MVT”>VIDEO TELECONFERENCING (MVT)</option>
<option value=“CSV”>VOICE (CSV)</option>
<option value=“IVO”>VOICE OVER IP TRANSPORT (IVO)</option>
<option value=“RVS”>VULNERABILITY SCANNING (RVS)</option>
<option value=“MWC”>WEB CONFERENCING (MWC)</option>
<option value=“WLS”>WIRELESS SERVICES (WLS)</option></select>

Is this what you want?

WebElement optionMac = WebUICommonHelper.findWebElement(By.xpath("//select[@id='service_type_code']/option[text()='AUDIO CONFERENCING (MAC)']")
String value = optionMac.getAttribute('value')   // --> "MAC"

Thanks for your reply. I have made the changes to the webelement.

It was running fine till yesterday my feature file. Now, I am getting the below error today. Can you please look into and suggest to proceed further ?

Keyword runFeatureFile was failed (Root cause: com.kms.katalon.core.exception.StepFailedException: Feature file ‘Include/features/GMPPortal1.feature’ was failed
** at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:48)**
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.stepFailed(KeywordMain.groovy:21)
at com.kms.katalon.core.keyword.internal.KeywordMain$stepFailed$0.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy:82)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:66)
at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:46)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile$0.callStatic(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:101)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile.call(Unknown Source)
at WSVerification1557212716684.run(WSVerification1557212716684:2)
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.WSVerificationExecutor.runScript(WSVerificationExecutor.java:146)
at com.kms.katalon.core.main.WSVerificationExecutor.doExecute(WSVerificationExecutor.java:140)
at com.kms.katalon.core.main.WSVerificationExecutor.processExecutionPhase(WSVerificationExecutor.java:123)
at com.kms.katalon.core.main.WSVerificationExecutor.accessMainPhase(WSVerificationExecutor.java:115)
at com.kms.katalon.core.main.WSVerificationExecutor.execute(WSVerificationExecutor.java:103)
at com.kms.katalon.core.main.TestCaseMain.runFeatureFile(TestCaseMain.java:144)
at com.kms.katalon.core.main.TestCaseMain$runFeatureFile$0.call(Unknown Source)
at TempTempCase1557212712266.run(TempTempCase1557212712266.groovy:21)

The stacktrace you attached provides very little information. More info please.

Thanks for your reply. I have attached all the content from the log. And also, when I try new recording to see how this error is occurring during the record, I am finding the chrome error which is also attached.

Log Content:
05-07-2019 01:01:27 PM SCENARIO Login in GMPA Application

Elapsed time: 5.657s

SCENARIO Login in GMPA Application FAILED.
Reason:
com.kms.katalon.core.exception.StepFailedException: Unable to open browser with url: ‘’
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.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
at GMPPortal.User_is_on_vagb_application(GMPPortal.groovy:60)
at ✽.User is on VAGB Application(C:/Users/vdavuluri2/Katalon Studio/Simple/Include/features/GMPPortal1.feature:18)
Caused by: org.openqa.selenium.SessionNotCreatedException: session not created: Chrome version must be between 70 and 73
(Driver info: chromedriver=73.0.3683.68 (47787ec04b6e38e22703e856e101e840b65afe72),platform=Windows NT 6.1.7601 SP1 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2.41 seconds
Build info: version: ‘3.7.1’, revision: ‘8a0099a’, time: ‘2017-11-06T21:07:36.161Z’
System info: host: ‘CSCINDAE751188’, ip: ‘135.210.136.247’, os.name: ‘Windows 7’, os.arch: ‘amd64’, os.version: ‘6.1’, java.version: ‘1.8.0_181’
Driver info: driver.version: CChromeDriver
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$new$0(JsonWireProtocolResponse.java:53)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$getResponseFunction$2(JsonWireProtocolResponse.java:91)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:123)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:126)
at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:73)
at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:142)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:600)
at com.kms.katalon.selenium.driver.CChromeDriver.execute(CChromeDriver.java:20)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:142)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:181)
at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:147)
at com.kms.katalon.selenium.driver.CChromeDriver.(CChromeDriver.java:13)
at com.kms.katalon.core.webui.driver.DriverFactory.createNewChromeDriver(DriverFactory.java:281)
at com.kms.katalon.core.webui.driver.DriverFactory.startNewBrowser(DriverFactory.java:243)
at com.kms.katalon.core.webui.driver.DriverFactory.openWebDriver(DriverFactory.java:188)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.doCall(OpenBrowserKeyword.groovy:74)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword$_openBrowser_closure1.call(OpenBrowserKeyword.groovy)
at com.kms.katalon.core.webui.keyword.internal.WebUIKeywordMain.runKeyword(WebUIKeywordMain.groovy:20)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.openBrowser(OpenBrowserKeyword.groovy:81)
at com.kms.katalon.core.webui.keyword.builtin.OpenBrowserKeyword.execute(OpenBrowserKeyword.groovy:67)
at com.kms.katalon.core.keyword.internal.KeywordExecutor.executeKeywordForPlatform(KeywordExecutor.groovy:56)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords.openBrowser(WebUiBuiltInKeywords.groovy:60)
at com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords$openBrowser.call(Unknown Source)
at GMPPortal.User_is_on_vagb_application(GMPPortal.groovy:60)
at cucumber.runtime.Utils$1.call(Utils.java:26)
at cucumber.runtime.Timeout.timeout(Timeout.java:16)
at cucumber.runtime.Utils.invoke(Utils.java:20)
at cucumber.runtime.java.JavaStepDefinition.execute(JavaStepDefinition.java:48)
at cucumber.runtime.PickleStepDefinitionMatch.runStep(PickleStepDefinitionMatch.java:50)
at cucumber.runner.TestStep.executeStep(TestStep.java:55)
at cucumber.runner.TestStep.run(TestStep.java:42)
at cucumber.runner.PickleStepTestStep.run(PickleStepTestStep.java:53)
at cucumber.runner.TestCase.run(TestCase.java:47)
at cucumber.runner.Runner.runPickle(Runner.java:44)
at cucumber.runtime.Runtime.runFeature(Runtime.java:120)
at cucumber.runtime.Runtime.run(Runtime.java:106)
at cucumber.api.cli.Main.run(Main.java:35)
at cucumber.api.cli.Main$run.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy:76)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$_runFeatureFile_closure1.doCall(CucumberBuiltinKeywords.groovy)
at com.kms.katalon.core.keyword.internal.KeywordMain.runKeyword(KeywordMain.groovy:66)
at com.kms.katalon.core.keyword.internal.KeywordMain$runKeyword.call(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:46)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile$0.callStatic(Unknown Source)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords.runFeatureFile(CucumberBuiltinKeywords.groovy:101)
at com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords$runFeatureFile.call(Unknown Source)
at WSVerification1557214285692.run(WSVerification1557214285692:2)
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.WSVerificationExecutor.runScript(WSVerificationExecutor.java:146)
at com.kms.katalon.core.main.WSVerificationExecutor.doExecute(WSVerificationExecutor.java:140)
at com.kms.katalon.core.main.WSVerificationExecutor.processExecutionPhase(WSVerificationExecutor.java:123)
at com.kms.katalon.core.main.WSVerificationExecutor.accessMainPhase(WSVerificationExecutor.java:115)
at com.kms.katalon.core.main.WSVerificationExecutor.execute(WSVerificationExecutor.java:103)
at com.kms.katalon.core.main.TestCaseMain.runFeatureFile(TestCaseMain.java:144)
at com.kms.katalon.core.main.TestCaseMain$runFeatureFile$0.call(Unknown Source)
at TempTempCase1557214282652.run(TempTempCase1557214282652.groovy:21)

For the Chrome error, update your Katalon Studio

or your chrome driver

Thank You, it is working fine now. I have upgraded the chrome driver.

Another thing that I am finding the error is again related to findWebElement. Can you please look into it ?

Code:
@And (“select the service as (.*)”)
def select_the_service_number_with(String servicec) {
WebElement textArea = WebUiCommonHelper.findWebElement(By.xpath("//select[@id=‘service_type_code’]"), 10)
textArea.selectByValue(servicec)
WebUI.delay(10)
}

Error from the log:
05-07-2019 02:48:50 PM select the service as WEB CONFERENCING (MWC)

Elapsed time: 0.073s

GMPDispute.select_the_service_number_with:261

select the service as WEB CONFERENCING (MWC) FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.webui.common.WebUiCommonHelper.findWebElement() is applicable for argument types: (org.openqa.selenium.By$ByXPath, java.lang.Integer) values: [By.xpath: //select[@id=‘service_type_code’], 10]
Possible solutions: findWebElement(com.kms.katalon.core.testobject.TestObject, int), findWebElements(com.kms.katalon.core.testobject.TestObject, int)
at GMPDispute.select_the_service_number_with(GMPDispute.groovy:261)
at ✽.select the service as WEB CONFERENCING (MWC)(C:/Users/vdavuluri2/Katalon Studio/Simple/Include/features/GMPDispute.feature:67)

You have to create a TestObject in ObjectRepository, then call

WebUiCommonHelper.findWebElement(findTestObject('path of the created object'), 10)

no… i am using xpath because the test object was too long and it cannot be stored in object repository.
so… I cannot store it the object repository.

I don’t understand why it couldn’t work like this :thinking:
image

WebUiCommonHelper.findWebElement(findTestObject('select_type_code'), 10)

Please find the attached file for your reference…

do you want me to rename it ?
OR then when do we use the xpath ?

Right click on ObjectRepository, create a Folder “Page_Create Dispute”. Then, on this Folder, right click and create a new TestObject, give it a short name like in my example, and use your XPath in Selector Editor

Edit : I See you also can rename the object in “Object Properties” then “Object name” directly in Object Spy

@And (“select the service as (.*)”)
def select_the_service_number_with(String servicec) {
WebElement textArea = WebUiCommonHelper.findWebElement(findTestObject(By.xpath("//select[@id=‘service_type_code’]"), 10))
textArea.selectByValue(servicec)
WebUI.delay(10)
}

Is this looks fine ?

Again… I am receiving the same error…

05-07-2019 03:57:02 PM select the service as WEB CONFERENCING (MWC)

Elapsed time: 0.078s

GMPDispute.select_the_service_number_with:261

select the service as WEB CONFERENCING (MWC) FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.testobject.ObjectRepository.findTestObject() is applicable for argument types: (org.openqa.selenium.By$ByXPath, java.lang.Integer) values: [By.xpath: //select[@id=‘service_type_code’], 10]
Possible solutions: findTestObject(java.lang.String), findTestObject(java.lang.String, java.util.Map)
at GMPDispute.select_the_service_number_with(GMPDispute.groovy:261)
at ✽.select the service as WEB CONFERENCING (MWC)(C:/Users/vdavuluri2/Katalon Studio/Simple/Include/features/GMPDispute.feature:67)

You don’t change the TestObject

@And (“select the service as (.*)”)
def select_the_service_number_with(String servicec) {
WebElement textArea = WebUiCommonHelper.findWebElement(findTestObject("Page_Create Dispute/name of the object"), 10)
textArea.selectByValue(servicec)
WebUI.delay(10)
}

Replace “name of the object” by the name you give to the Object

still there is an error… can you please suggest !!

Code:
@And (“select the service as (.*)”)
def select_the_service_number_with(String servicec) {
WebElement textArea = WebUiCommonHelper.findWebElement(findTestObject(‘Object Repository/Page_Create Dispute/servicetype_code’, 10))
textArea.selectOptionByValue(servicec)

Error Log
05-07-2019 06:18:03 PM select the service as WEB CONFERENCING (MWC)

Elapsed time: 0.051s

GMPDispute.select_the_service_number_with:264

select the service as WEB CONFERENCING (MWC) FAILED.
Reason:
groovy.lang.MissingMethodException: No signature of method: static com.kms.katalon.core.testobject.ObjectRepository.findTestObject() is applicable for argument types: (java.lang.String, java.lang.Integer) values: [Object Repository/Page_Create Dispute/servicetype_code, 10]
Possible solutions: findTestObject(java.lang.String), findTestObject(java.lang.String, java.util.Map), findRequestObject(java.lang.String, java.io.File)
at GMPDispute.select_the_service_number_with(GMPDispute.groovy:264)
at ✽.select the service as WEB CONFERENCING (MWC)(C:/Users/vdavuluri2/Katalon Studio/Simple/Include/features/GMPDispute.feature:67)