PageSourceSearch

https://docs-production-katalon.netlify.app/assets/js/917a3040.5a8695e6.js

js docs-production-katalon.netlify.app collected 2026-10-03 10:41:25 UTC 12,028 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkKatalon_Docs=self.webpackChunkKatalon_Docs||[]).push([[6660],{6904:(e,t,a)=>{a.r(t),a.d(t,{assets:()=>c,contentTitle:()=>r,default:()=>h,frontMatter:()=>l,metadata:()=>s,toc:()=>d});const s=JSON.parse('{"id":"keywords/using-keywords-in-katalon-studio/mobile-testing/using-list-to-store-the-mobile-elements-to-validate-data-in-katalon-studio","title":"Using List to Store the Mobile Elements to Validate Data in Katalon Studio","description":"Scenario","source":"@site/docs/katalon-studio/keywords/using-keywords-in-katalon-studio/mobile-testing/using-list-to-store-the-mobile-elements-to-validate-data-in-katalon-studio.md","sourceDirName":"keywords/using-keywords-in-katalon-studio/mobile-testing","slug":"/keywords/using-keywords-in-katalon-studio/mobile-testing/using-list-to-store-the-mobile-elements-to-validate-data-in-katalon-studio","permalink":"/katalon-studio/keywords/using-keywords-in-katalon-studio/mobile-testing/using-list-to-store-the-mobile-elements-to-validate-data-in-katalon-studio","draft":false,"unlisted":false,"tags":[],"version":"current","lastUpdatedAt":1758935351000,"frontMatter":{"title":"Using List to Store the Mobile Elements to Validate Data in Katalon Studio"},"sidebar":"katalon-studio","previous":{"title":"Handling Drag and Drop in Mobile App in Katalon Studio","permalink":"/katalon-studio/keywords/using-keywords-in-katalon-studio/mobile-testing/handling-drag-and-drop-in-mobile-app-in-katalon-studio"},"next":{"title":"Handling Spinner in Mobile Automation Testing in Katalon Studio","permalink":"/katalon-studio/keywords/using-keywords-in-katalon-studio/mobile-testing/handling-spinner-in-mobile-automation-testing-in-katalon-studio"}}');var n=a(74848),i=a(28453),o=a(86025);const l={title:"Using List to Store the Mobile Elements to Validate Data in Katalon Studio"},r=void 0,c={},d=[{value:'<a class="anchor_top_offset"></a>Scenario',id:"scenario",level:2},{value:'<a class="anchor_top_offset"></a>Manual Mode',id:"manual-mode",level:2},{value:'<a class="anchor_top_offset"></a>Script Mode',id:"script-mode",level:2}];function m(e){const t={code:"code",h2:"h2",pre:"pre",...(0,i.R)(),...e.components};return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(t.h2,{id:"scenario",children:[(0,n.jsx)("a",{id:"id_1",class:"anchor_top_offset"}),"Scenario"]}),"\n",(0,n.jsx)("p",{xmlns:"http://www.w3.org/1999/xhtml",className:"p",children:"We want to select a Radio button from a List. In order to do so,   we need to capture all the button elements in a collection and pick   the desired Radio button."}),"\n",(0,n.jsxs)(t.h2,{id:"manual-mode",children:[(0,n.jsx)("a",{id:"id_2",class:"anchor_top_offset"}),"Manual Mode"]}),"\n",(0,n.jsx)("ul",{xmlns:"http://www.w3.org/1999/xhtml",className:"ul",children:(0,n.jsxs)("li",{className:"li",children:["Step 1: Select ",(0,n.jsx)("strong",{className:"ph b",children:"Start       Application"})," from Mobile keyword and click on     ",(0,n.jsx)("strong",{className:"ph b",children:"Input"})," it will open a window. In     ",(0,n.jsx)("strong",{className:"ph b",children:"appFile"}),", select ",(0,n.jsx)("strong",{className:"ph b",children:"Value Type"})," as     ",(0,n.jsx)("strong",{className:"ph b",children:"Variable"}),". In ",(0,n.jsx)("strong",{className:"ph b",children:"Value"}),", pass the     variable name as ",(0,n.jsx)("strong",{className:"ph b",children:"path"}),"."]})}),"\n",(0,n.jsxs)("p",{xmlns:"http://www.w3.org/1999/xhtml",className:"p",children:[(0,n.jsx)("img",{className:"image",src:(0,o.Ay)("https://github.com/katalon-studio/docs-images/raw/master/katalon-studio/tutorials/store_mobile_elements_to_validate_data/Using-List-to-Store-the-Mobile-Elements-to-Validate-Data-1.png"),alt:"Select an element from a list in mobile automation"}),(0,n.jsx)("br",{}),(0,n.jsx)("br",{})]}),"\n",(0,n.jsxs)("ul",{xmlns:"http://www.w3.org/1999/xhtml",className:"ul",children:[(0,n.jsxs)("li",{className:"li",children:["Step 2: Add ",(0,n.jsx)("strong",{className:"ph b",children:"Wait For Element Present"}),"     item."]}),(0,n.jsxs)("li",{className:"li",children:["Step 3: Call ",(0,n.jsx)("strong",{className:"ph b",children:"Scroll To Text"})," from mobile     keyword, pass the input as ",(0,n.jsx)("strong",{className:"ph b",children:"Views"}),". ",(0,n.jsx)("strong",{className:"ph b",children:"Scroll       To Text"})," accepts String type parameter (Text of the element     to scroll to)."]})]}),"\n",(0,n.jsxs)("p",{xmlns:"http://www.w3.org/1999/xhtml",className:"p",children:[(0,n.jsx)("img",{className:"image",src:(0,o.Ay)("https://github.com/katalon-studio/docs-images/raw/master/katalon-studio/tutorials/store_mobile_elements_to_validate_data/Using-List-to-Store-the-Mobile-Elements-to-Validate-Data-9.png"),alt:"Select an element from a list in mobile automation"}),(0,n.jsx)("br",{}),(0,n.jsx)("br",{})]}),"\n",(0,n.jsxs)("ul",{xmlns:"http://www.w3.org/1999/xhtml",className:"ul",children:[(0,n.jsxs)("li",{className:"li",children:["Step 4: Call ",(0,n.jsx)("strong",{className:"ph b",children:"Tap"})," method and pass the object of     ",(0,n.jsx)("strong",{className:"ph b",children:"Views."}),"   "]}),(0,n.jsxs)("li",{className:"li",children:["Step 5: Call ",(0,n.jsx)("strong",{className:"ph b",children:"Scroll To Text"})," from mobile     keyword, pass the input as ",(0,n.jsx)("strong",{className:"ph b",children:"Radio Group."}),"   "]}),(0,n.jsxs)("li",{className:"li",children:["Step 6: Tap on ",(0,n.jsx)("strong",{className:"ph b",children:"Radio Group."}),"   "]}),(0,n.jsxs)("li",{className:"li",children:["Step 7: After tapping on 'Radio Group', we want to     ",(0,n.jsx)("strong",{className:"ph b",children:"wait"})," for heading '",(0,n.jsx)("strong",{className:"ph b",children:"Views/Radio       Group"}),"' to be ",(0,n.jsx)("strong",{className:"ph b",children:"visible"})," on the screen."]}),(0,n.jsxs)("li",{className:"li",children:["Step 8: Add a ",(0,n.jsx)("strong",{className:"ph b",children:"binary statement"})," to initialize     ",(0,n.jsx)("strong",{className:"ph b",children:"Appium Driver"})," with Katalon ",(0,n.jsx)("strong",{className:"ph b",children:"Mobile       Driver"}),"."]}),(0,n.jsxs)("li",{className:"li",children:["Step 9: Add another ",(0,n.jsx)("strong",{className:"ph b",children:"binary statement"})," to get     all radio elements and store in a List. In ",(0,n.jsx)("strong",{className:"ph b",children:"Left       Expression"}),", select '",(0,n.jsx)("strong",{className:"ph b",children:"Variable"}),"' as     ",(0,n.jsx)("strong",{className:"ph b",children:"Value Type"})," and pass '",(0,n.jsx)("strong",{className:"ph b",children:"elements"}),"' in     ",(0,n.jsx)("strong",{className:"ph b",children:"Value"}),". In ",(0,n.jsx)("strong",{className:"ph b",children:"Right expression"}),",     select '",(0,n.jsx)("strong",{className:"ph b",children:"Method Call"}),"' as ",(0,n.jsx)("strong",{className:"ph b",children:"Value       Type"})," and pass the list of radio buttons object     information."]})]}),"\n",(0,n.jsxs)("p",{xmlns:"http://www.w3.org/1999/xhtml",className:"p",children:[(0,n.jsx)("img",{className:"image",src:(0,o.Ay)("https://github.com/katalon-studio/docs-images/raw/master/katalon-studio/tutorials/store_mobile_elements_to_validate_data/Using-List-to-Store-the-Mobile-Elements-to-Validate-Data-92.png"),alt:"Select an element from a list in mobile automation"}),(0,n.jsx)("br",{}),(0,n.jsx)("br",{})]}),"\n",(0,n.jsx)("ul",{xmlns:"http://www.w3.org/1999/xhtml",className:"ul",children:(0,n.jsxs)("li",{className:"li",children:["Step 10: Add a ",(0,n.jsx)("strong",{className:"ph b",children:"for-each loop"})," statement."]})}),"\n",(0,n.jsxs)("p",{xmlns:"http://www.w3.org/1999/xhtml",className:"p",children:[(0,n.jsx)("img",{className:"image",src:(0,o.Ay)("https://github.com/katalon-studio/docs-images/raw/master/katalon-studio/tutorials/store_mobile_elements_to_validate_data/Using-List-to-Store-the-Mobile-Elements-to-Validate-Data-10.png"),alt:"Select an element from a list in mobile automation"}),(0,n.jsx)("br",{}),(0,n.jsx)("br",{})]}),"\n",(0,n.jsxs)("ul",{children:[" ",(0,n.jsx)("li",{children:' Step 10.1: Add a binary statement to capture the text of each element in the list and store it in the "actual_Text" variable. '})," "]}),"\n",(0,n.jsxs)("ul",{children:[(0,n.jsx)("li",{children:" Step 10.2: Add 'if' statement and verify whether the actual text matches the expected text. When the actual text matches the expected text, perform click action on Radio button. "})," "]}),"\n",(0,n.jsxs)("ul",{children:[" ",(0,n.jsx)("li",{children:" Step 10.3: After performing click event, we need to terminate for each loop. Add a method call statement 'break' to achieve this. "})," "]}),"\n",(0,n.jsxs)(t.h2,{id:"script-mode",children:[(0,n.jsx)("a",{id:"id_3",class:"anchor_top_offset"}),"Script Mode"]}),"\n",(0,n.jsx)(t.pre,{children:(0,n.jsx)(t.code,{className:"language-jsx",children:"import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject\nimport org.openqa.selenium.WebElement as WebElement\nimport com.kms.katalon.core.configuration.RunConfiguration as RunConfiguration\nimport com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile\nimport com.kms.katalon.core.mobile.keyword.internal.MobileDriverFactory as MobileDriverFactory\nimport com.kms.katalon.core.model.FailureHandling as FailureHandling\nimport io.appium.java_client.AppiumDriver as AppiumDriver\n\n'Path of the Apk File Store in path variable' \ndef path = RunConfiguration.getProjectDir() + '/Data Files/ApiDemos.apk'\n\n'Start the application' \nMobile.startApplication(path, false)\n\n'Wait for element Present of Heading API Demos' \nMobile.waitForElementPresent(findTestObject('API Demos Objects/List_Example/heading_API_Demos'), 45)\n\n'Scroll to Views text' \nMobile.scrollToText('Views', FailureHandling.STOP_ON_FAILURE)\n\n'Tap on Vie
1ws' \nMobile.tap(findTestObject('API Demos Objects/List_Example/text_Views'), 20)\n\n'Scroll to Radio Group text' \nMobile.scrollToText('Radio Group', FailureHandling.STOP_ON_FAILURE)\n\n'Tap on Radio Group' \nMobile.tap(findTestObject('API Demos Objects/List_Example/text_Radio Group'), 30)\n \n'Wait for Element Present of Header Radio Group'\nMobile.waitForElementPresent(findTestObject('API Demos Objects/List_Example/text_Header Radio Group'), 30)\n\n'Initializing Appium Driver by Katalon Mobile Driver' \nAppiumDriver<?> driver = MobileDriverFactory.getDriver()\n\n'Getting all similar elements and storing in to List' \nList<WebElement> elements = driver.findElementsByClassName('android.widget.RadioButton')\n\n'Printing the Size of list elements' \nprintln('The size of elements is ::' + elements.size())\n \n'Here Using For each loop for iterations' \nfor (WebElement radio : elements) {\n    'Get the text of each element in the list and store in to the \"actual_Text\" variable.'\n    String actual_Text = radio.getText()\n    \n    'Here verifying the actual text with expected text of \"Dinner\" on every iteration' \n     if(actual_Text.equals(\"Dinner\")){\n        'Click on expected Element \"Dinner\" '\n        radio.click();\n\n        'Break the loop'\n        break;\n     }\n}\n"})}),"\n",(0,n.jsxs)("p",{xmlns:"http://www.w3.org/1999/xhtml",className:"p",children:["The source code is available at ",(0,n.jsx)("a",{className:"xref j-external-link",href:"https://github.com/katalon-studio/katalon-mobile-automation",target:"_blank",children:"katalon-studio/katalon-mobile-automation"}),"."]})]})}function h(e={}){const{wrapper:t}={...(0,i.R)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(m,{...e})}):m(e)}},28453:(e,t,a)=>{a.d(t,{R:()=>o,x:()=>l});var s=a(96540);const n={},i=s.createContext(n);function o(e){const t=s.useContext(i);return s.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function l(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(n):e.components||n:o(e.components),s.createElement(i.Provider,{value:t},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.