TestProject Forum

How to identify a record in a multipage table and perform action on it?

In my application, I am adding a user, after adding the user that user will display in a multipage table. Now my question is I need to search that user on the first page and if that user is not available on the first page, using pagination I need to go to the next pages, search and find that user record, and edit that user. Can you tell me how to perform this action using TestProject?

Thanks in advance.

Hi @mug2kor,
You will need to create a subtest that search the element in a loop.
I have created a test and shared it here:

id: kDmWMtuN6EmMGqxMg3880A
projectId: I4xezu2IYEaMpOXaW0CaLQ
projectName: '! - Amit'
created: 2021-12-20T17:11:44.9200736Z
owner: Amit amit.lacher@testproject.io
protocol: 1
tests:
- id: 803E0ftE2U6u9bfNFrQB_g
  name: Test 2
  description: ''
  platform: Web
  type: Web
  driverType: Chrome
  version: 0.1
  creationDate: 2021-11-22T11:51:54.0000000
  modificationDate: 2021-12-20T17:02:46.0000000
  settings:
    automationAssistant: true
    appId: pEL8IpP74U2pirKvfX29Dw
    stepSleepTime: 500
    stepTimeout: 15000
    stepSleepTiming: Before
    stepFailureBehaviorType: Abort
    stepTakeScreenshotConditionType: Failure
  application:
    id: pEL8IpP74U2pirKvfX29Dw
    name: Example
    url: https://example.testproject.io
    platform: Web
  steps:
  - id: 3-SgjqWo6UKAi4KV_OJsxQ
    comments: Navigates the specified URL (Auto-generated)
    enabled: true
    invertResult: false
    order: 1
    repeat: 1
    type: Action
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 49c5d8d8-4ba8-42f0-823d-702e6acfb23a
      source: System
    parameterMaps:
    - name: url
      value: https://www.airbnb.com/
      direction: Input
    conditions: []
    validations: []
    contexts: []
  - id: M4D5qoC5EUySQhIiOwnyFQ
    enabled: true
    invertResult: false
    order: 2
    repeat: 1
    type: Action
    elementId: 7CBFj892A0ezfcMqFeRAmw
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 02d572b2-d610-4700-9ad3-40076ddb9807
      source: System
    parameterMaps: []
    conditions: []
    validations: []
    contexts: []
  - id: IYTCGzXSXU6fgHNazG7nRQ
    enabled: true
    invertResult: false
    order: 3
    repeat: 1
    type: Action
    elementId: 7CBFj892A0ezfcMqFeRAmw
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 6f94fdaa-0041-4265-b73b-ecfcbe702d66
      source: System
    parameterMaps:
    - name: keys
      value: London
      direction: Input
    conditions: []
    validations: []
    contexts: []
  - id: 9v-_B5wOeUyk2gJBnyyAGw
    enabled: true
    invertResult: false
    order: 4
    repeat: 1
    type: Action
    elementId: PGxQeoqUh0SLeXUiU86elQ
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 02d572b2-d610-4700-9ad3-40076ddb9807
      source: System
    parameterMaps: []
    conditions: []
    validations: []
    contexts: []
  - id: tkgU8iovp0WrV6Bd8Dg0FA
    enabled: true
    invertResult: false
    order: 5
    repeat: 1
    type: Action
    elementId: _Uey0T37tUCYVzkRJOkjvg
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 02d572b2-d610-4700-9ad3-40076ddb9807
      source: System
    parameterMaps: []
    conditions: []
    validations: []
    contexts: []
  - id: -l0wfnd5LUykTuCHgBN-WA
    enabled: true
    invertResult: false
    order: 6
    repeat: 1
    type: Action
    elementId: QCnuPNr_c0mc6qfSPtr3jQ
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 02d572b2-d610-4700-9ad3-40076ddb9807
      source: System
    parameterMaps: []
    conditions: []
    validations: []
    contexts: []
  - id: QEqF27lOMk6P4rE6BembTw
    enabled: true
    invertResult: false
    order: 7
    repeat: 1
    type: Action
    elementId: KRWcJkbe-0qYZ0wPl9V2NA
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 02d572b2-d610-4700-9ad3-40076ddb9807
      source: System
    parameterMaps: []
    conditions: []
    validations: []
    contexts: []
  - id: 8De1QVFFsUWBNmck2UO77Q
    enabled: true
    invertResult: false
    order: 8
    repeat: 1
    type: Action
    elementId: EPRMgwLBiECTNCMEvZZKGg
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 02d572b2-d610-4700-9ad3-40076ddb9807
      source: System
    parameterMaps: []
    conditions: []
    validations: []
    contexts: []
  - id: Mddi71PiT0-UCPN_-V6W-w
    enabled: true
    invertResult: false
    order: 9
    repeat: 1
    type: Action
    elementId: QMMxpABh9EuuktkTPjH5ww
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 02d572b2-d610-4700-9ad3-40076ddb9807
      source: System
    parameterMaps: []
    conditions: []
    validations: []
    contexts: []
  - id: 4dWA8wHebkWfmNmY7nFQwA
    comments: ''
    enabled: true
    invertResult: false
    order: 10
    repeat: 1
    type: Action
    elementId: BaHnz-Sx1E6rev1dn2gdUA
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 02d572b2-d610-4700-9ad3-40076ddb9807
      source: System
    parameterMaps: []
    conditions: []
    validations: []
    contexts: []
  - id: u1hjwlIdj0q44HGSgAegkg
    comments: This step was auto generated from several steps
    enabled: true
    invertResult: false
    order: 11
    repeat: 20
    type: Test
    targetTestId: uxL9vYr9rECiaXQ9ZKc8YA
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      source: None
    parameterMaps:
    - name: page
      value: ''
      direction: Input
    conditions:
    - parameter: '[[isVisible]]'
      type: Equals
      invert: false
      value: 0
    validations: []
    contexts: []
  parameters:
  - name: ApplicationURL
    description: Auto generated application URL parameter
    value: https://example.testproject.io
    type: Private
  - name: Exp_care_value
    description: >2

    value: ''
    type: Input
  - name: DropboxAuthToken
    description: ''
    type: Private
  - name: equals
    description: ''
    value: =
    type: Input
  - name: ClipboardURL
    description: ''
    value: ''
    type: Input
  - name: TEXT
    description: ''
    value: ''
    type: Input
  - name: array
    description: ''
    value: ''
    type: Input
  - name: page
    description: ''
    value: 2
    type: Input
auxTests:
- id: uxL9vYr9rECiaXQ9ZKc8YA
  name: Find and validate specific room
  description: This test was auto generated from steps of the 'Test 2' test
  platform: Web
  type: Web
  driverType: Chrome
  version: 1.0
  creationDate: 2021-12-20T16:54:54.0000000
  modificationDate: 2021-12-20T17:00:10.0000000
  settings:
    automationAssistant: true
    appId: pEL8IpP74U2pirKvfX29Dw
    stepSleepTime: 500
    stepTimeout: 15000
    stepSleepTiming: Before
    stepFailureBehaviorType: Abort
    stepTakeScreenshotConditionType: Failure
  steps:
  - id: mQ0-vZbrrUSQtzQFnTGPBw
    comments: ''
    enabled: true
    invertResult: false
    order: 1
    repeat: 1
    type: Addon
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 72Wa_2Vse0uCOCY58ZbcCA
      source: Store
      addonId: Ow3LGSkBqUyGjzyAibUJig
    parameterMaps:
    - name: byType
      value: XPATH
      direction: Input
    - name: byString
      value: //div[. = 'Perfect studio with balcony']
      direction: Input
    - name: visibleOnly
      value: ''
      direction: Input
    - name: amount
      value: '[[isVisible]]'
      direction: Output
    conditions: []
    validations: []
    contexts: []
  - id: fg-sB1BxoEWuzhGWYQX2zQ
    comments: This step was auto generated from several steps
    enabled: true
    invertResult: false
    order: 2
    repeat: 1
    type: Test
    targetTestId: NYj39o6caUG9Th6OeVGsmA
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      source: None
    parameterMaps:
    - name: page
      value: ''
      direction: Input
    conditions:
    - parameter: '[[isVisible]]'
      type: Equals
      invert: false
      value: 0
    validations: []
    contexts: []
  - id: TqewBaowjkuNNk-dGQUvaQ
    comments: This step was auto generated from several steps
    enabled: true
    invertResult: false
    order: 3
    repeat: 1
    type: Test
    targetTestId: hDrFMP-vTkOriWMhexXDIA
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      source: None
    parameterMaps: []
    conditions:
    - parameter: '[[isVisible]]'
      type: Equals
      invert: false
      value: 1
    validations: []
    contexts: []
  parameters:
  - name: page
    description: ''
    value: 2
    type: Input
- id: hDrFMP-vTkOriWMhexXDIA
  name: Validate
  description: This test was auto generated from steps of the 'Test 2' test
  platform: Web
  type: Web
  driverType: Chrome
  version: 1.0
  creationDate: 2021-12-20T16:46:23.0000000
  modificationDate: 2021-12-20T16:46:23.0000000
  settings:
    automationAssistant: true
    appId: pEL8IpP74U2pirKvfX29Dw
    stepSleepTime: 500
    stepTimeout: 15000
    stepSleepTiming: Before
    stepFailureBehaviorType: Abort
    stepTakeScreenshotConditionType: Failure
  steps:
  - id: RwvokVsGz02N9g3Mj0qDOw
    comments: ''
    enabled: true
    invertResult: false
    order: 1
    repeat: 1
    type: Addon
    elementId: OVYs6rtPJk-OYFzU9s68tQ
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: Nv5yOK03QkCH5IC9CwaKoQ
      source: Store
      addonId: 9G7qW0nEqU60ObO6IXJshg
    parameterMaps:
    - name: numberOfScrolls
      value: ''
      direction: Input
    conditions: []
    validations: []
    contexts: []
  - id: KquPU0aSV0-K67fGGUIwWA
    comments: ''
    enabled: true
    invertResult: false
    order: 2
    repeat: 1
    type: Action
    elementId: OVYs6rtPJk-OYFzU9s68tQ
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 85da72d0-c5a4-4587-be33-8cb3b5fa7910
      source: System
    parameterMaps:
    - name: text
      value: Perfect studio with balcony
      direction: Input
    conditions: []
    validations: []
    contexts: []
  parameters: []
- id: NYj39o6caUG9Th6OeVGsmA
  name: scroll to next page
  description: This test was auto generated from steps of the 'Test 2' test
  platform: Web
  type: Web
  driverType: Chrome
  version: 1.0
  creationDate: 2021-12-20T16:53:57.0000000
  modificationDate: 2021-12-20T17:08:09.0000000
  settings:
    automationAssistant: true
    appId: pEL8IpP74U2pirKvfX29Dw
    stepSleepTime: 500
    stepTimeout: 15000
    stepSleepTiming: Before
    stepFailureBehaviorType: Abort
    stepTakeScreenshotConditionType: Failure
  steps:
  - id: GQSgobu2nEm0QUDXRG3Njw
    comments: ''
    enabled: true
    invertResult: false
    order: 1
    repeat: 1
    type: Addon
    elementId: 5D97XWnDGkqE15sYPaW9nQ
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: Nv5yOK03QkCH5IC9CwaKoQ
      source: Store
      addonId: 9G7qW0nEqU60ObO6IXJshg
    parameterMaps:
    - name: numberOfScrolls
      value: ''
      direction: Input
    conditions: []
    validations: []
    contexts: []
  - id: lkJwvHb_ok-QoS66qDZaog
    comments: ''
    enabled: true
    invertResult: false
    order: 2
    repeat: 1
    type: Action
    elementId: M_-0QJhrT0OZ44XsAedSQg
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 02d572b2-d610-4700-9ad3-40076ddb9807
      source: System
    parameterMaps: []
    conditions: []
    validations: []
    contexts: []
  - id: Q_mG2lqa00mOFpCE-WRRPA
    comments: ''
    enabled: true
    invertResult: false
    order: 3
    repeat: 1
    type: Addon
    settings:
      sleepTime: -1
      timeout: -1
      sleepTiming: Inherit
      failureBehaviorType: Inherit
      takeScreenshotConditionType: Inherit
    action:
      id: 6ud5oPOg9kaqrUjWtnz_pw
      source: Store
      addonId: rxLEAqSrKE-MmdgcUtqD4Q
    parameterMaps:
    - name: result
      value: '[[Page]]'
      direction: Output
    - name: expression
      value: '[[Page]]+1'
      direction: Input
    conditions: []
    validations: []
    contexts: []
  parameters:
  - name: page
    description: ''
    value: 2
    type: Input
elements:
- id: 7CBFj892A0ezfcMqFeRAmw
  name: query
  type:
    id: jUwODgyNjAyNzk2NTk1NDM
    name: Generic Web Element
    source: System
  locators:
  - name: CSSSELECTOR
    value: '#bigsearch-query-location-input'
    priority: 0
  - name: CSSSELECTOR
    value: "[name='query']"
    priority: 1
  - name: XPATH
    value: //input[@placeholder = 'Where are you going?']
    priority: 2
  - name: XPATH
    value: //label//input
    priority: 3
  - name: XPATH
    value: /html/body/div[5]/div/div/div[1]/div/div/div/div/div/div[1]/div/div/div/header/div/div[2]/div/div/div/div[2]/div/div/form/div[2]/div/div[1]/div/label/div/input
    priority: 4
- id: PGxQeoqUh0SLeXUiU86elQ
  name: Add dates
  type:
    id: jUwODgyNjAyNzk2NTk1NjM
    name: Div
    source: System
  locators:
  - name: XPATH
    value: //div[1]/div/div/div[. = 'Add dates']
    priority: 0
  - name: XPATH
    value: //div[2]/div/div[3]/div[1]/div/div/div[2]
    priority: 1
  - name: XPATH
    value: /html/body/div[5]/div/div/div[1]/div/div/div/div/div/div[1]/div/div/div/header/div/div[2]/div/div/div/div[2]/div/div/form/div[2]/div/div[3]/div[1]/div/div/div[2]
    priority: 2
- id: _Uey0T37tUCYVzkRJOkjvg
  name: 22
  type:
    id: jUwODgyNjAyNzk2NTk1NjM
    name: Div
    source: System
  locators:
  - name: XPATH
    value: //td[4]/div/div[. = '22']
    priority: 0
  - name: XPATH
    value: //div[2]/div/table/tbody/tr[4]/td[4]/div/div
    priority: 1
  - name: XPATH
    value: /html/body/div[5]/div/div/div[1]/div/div/div/div/div/div[1]/div/div/div/header/div/div[2]/div/div/div/div[2]/div/div/form/div[2]/div/div[3]/div[2]/div/div/section/div/div/div/div/div[2]/div[1]/div[1]/div/div/div/div[2]/div[2]/div/div[2]/div/table/tbody/tr[4]/td[4]/div/div
    priority: 2
- id: QCnuPNr_c0mc6qfSPtr3jQ
  name: 16
  type:
    id: jUwODgyNjAyNzk2NTk1NjM
    name: Div
    source: System
  locators:
  - name: XPATH
    value: //td[1]/div/div/div[. = '16']
    priority: 0
  - name: XPATH
    value: //div[3]/div/table/tbody/tr[4]/td[1]/div/div/div
    priority: 1
  - name: XPATH
    value: /html/body/div[5]/div/div/div[1]/div/div/div/div/div/div[1]/div/div/div/header/div/div[2]/div/div/div/div[2]/div/div/form/div[2]/div/div[3]/div[4]/div/div/section/div/div/div/div/div[2]/div[1]/div[1]/div/div/div/div[2]/div[2]/div/div[3]/div/table/tbody/tr[4]/td[1]/div/div/div
    priority: 2
- id: KRWcJkbe-0qYZ0wPl9V2NA
  name: Add guests
  type:
    id: jUwODgyNjAyNzk2NTk1NjM
    name: Div
    source: System
  locators:
  - name: XPATH
    value: //div[. = 'Add guests']
    priority: 0
  - name: XPATH
    value: //div/div[5]/div[1]/div/div[2]
    priority: 1
  - name: XPATH
    value: /html/body/div[5]/div/div/div[1]/div/div/div/div/div/div[1]/div/div/div/header/div/div[2]/div/div/div/div[2]/div/div/form/div[2]/div/div[5]/div[1]/div/div[2]
    priority: 2
- id: EPRMgwLBiECTNCMEvZZKGg
  name: path
  type:
    id: jUwODgyNjAyNzk2NTk1NDM
    name: Generic Web Element
    source: System
  locators:
  - name: XPATH
    value: //div[1]/div[2]/button[2]//*[name()='path']
    priority: 0
  - name: XPATH
    value: /html/body/div[5]/div/div/div[1]/div/div/div/div/div/div[1]/div/div/div/header/div/div[2]/div/div/div/div[2]/div/div/form/div[2]/div/div[5]/div[2]/div/section/div/div/div[1]/div[1]/div[2]/button[2]/span/*[name()='svg']/*[name()='path']
    priority: 1
- id: QMMxpABh9EuuktkTPjH5ww
  name: path1
  type:
    id: jUwODgyNjAyNzk2NTk1NDM
    name: Generic Web Element
    source: System
  locators:
  - name: XPATH
    value: //div[1]/div[2]/button[2]//*[name()='path']
    priority: 0
  - name: XPATH
    value: /html/body/div[5]/div/div/div[1]/div/div/div/div/div/div[1]/div/div/div/header/div/div[2]/div/div/div/div[2]/div/div/form/div[2]/div/div[5]/div[3]/div/section/div/div/div[1]/div[1]/div[2]/button[2]/span/*[name()='svg']/*[name()='path']
    priority: 1
- id: BaHnz-Sx1E6rev1dn2gdUA
  name: Search
  type:
    id: jUwODgyNjAyNzk2NTk1NDc
    name: Button
    source: System
  locators:
  - name: XPATH
    value: //button[. = 'Search']
    priority: 0
  - name: XPATH
    value: //div[4]/button
    priority: 1
  - name: XPATH
    value: /html/body/div[5]/div/div/div[1]/div/div/div/div/div/div[1]/div/div/div/header/div/div[2]/div/div/div/div[2]/div/div/form/div[2]/div/div[5]/div[4]/button
    priority: 2
- id: 5D97XWnDGkqE15sYPaW9nQ
  name: Last room
  type:
    id: jUwODgyNjAyNzk2NTk1NjM
    name: Div
    source: System
  locators:
  - name: XPATH
    value: //div[20]/div/div/div[2]/div/div/div/div/a
    priority: 0
- id: M_-0QJhrT0OZ44XsAedSQg
  name: 2
  type:
    id: jUwODgyNjAyNzk2NTk1NTE
    name: Link
    source: System
  locators:
  - name: XPATH
    value: //a[. = '[[Page]]']
    priority: 0
  - name: XPATH
    value: //div/div/div/div/div/div/nav/div/a[1]
    priority: 1
  - name: XPATH
    value: /html/body/div[5]/div/div/div[1]/div/div/div/div/div/div[1]/div/div[1]/div/div[2]/div/main/div[6]/div/div/div/div/div/div/nav/div/a[1]
    priority: 2
- id: OVYs6rtPJk-OYFzU9s68tQ
  name: Perfect studio with balcony
  type:
    id: jUwODgyNjAyNzk2NTk1NjM
    name: Div
    source: System
  locators:
  - name: XPATH
    value: //div[. = 'Perfect studio with balcony']
    priority: 0
projectParameters:
- id: 3PNNgSSep0u4LCEMYe_Q-g
  name: isVisible
  description: ''
  value: 0
- id: GISSdbIq2kiaBXB5DZYoiA
  name: Page
  description: ''
  value: 2
addons:
- id: rxLEAqSrKE-MmdgcUtqD4Q
  source: Store
  version: 0.4
  actions:
  - id: 6ud5oPOg9kaqrUjWtnz_pw
    name: Evaluate Mathematical Expression
    description: Evaluate {{expression}}
    className: addon.EvaluateMathExpr
  minSdkLevel: 2
  minSdkVersion: 0.62.0
  sdkGeneration: 1
  language: Java
  hash: 3A2995AE450D978B95B8D92A896E0FC122A177E018E865DF9A9A83CFA5815463
- id: Ow3LGSkBqUyGjzyAibUJig
  source: Store
  version: 2.8
  actions:
  - id: 72Wa_2Vse0uCOCY58ZbcCA
    name: Count Elements
    description: Count element found by {{locator}}
    className: io.testproject.addons.element.web.CountElementsFoundByWeb
  minSdkLevel: 2
  minSdkVersion: 0.65.0
  sdkGeneration: 1
  language: Java
  hash: A589F45A9AC2C9F57FF6444BC6E9504C2F17FD5054E39E6066665079B054FAB2
- id: 9G7qW0nEqU60ObO6IXJshg
  source: Store
  version: 1.9
  actions:
  - id: Nv5yOK03QkCH5IC9CwaKoQ
    name: Scroll To Element With Javascript
    description: Using Javascript to scroll to the element
    className: io.testproject.addon.jsactions.ScrollToElementAction
  minSdkLevel: 2
  minSdkVersion: 0.65.0
  sdkGeneration: 1
  language: Java
  hash: 391BA51B31B3A1CADC112A2DD7D674CCC8AA80895D1FB9B1A90928D01D0153F3

Copy and paste it into a YAML file and you will be able to import it to your account.
The test does the following:

  • Search for the element.
  • If element not found in the page find the next page and click on it.
  • Search for element again until element found.
  • If element found break the loop.

Thanks a lot Amit. I will try and update you.