0

Hi I am facing problem to identify cause @id is dynamic :-

//div[@id='SubmissionWizard:LOBWizardStepGroup:LineWizardStepSet:WC7LineCoverageScreen:WC7LineCoverageCV:WC7ConditionsDV:5:CoverageInputSet:ConditionInputGroup:PolicyOwnerOfficerLV-body']//tr[RowIndex]//td[ColIndex+5]/div[@class='x-grid-cell-inner ']

In the above @id is

SubmissionWizard:LOBWizardStepGroup:LineWizardStepSet:WC7LineCoverageScreen:WC7LineCoverageCV:WC7ConditionsDV:5:CoverageInputSet:ConditionInputGroup:PolicyOwnerOfficerLV-body

In second attempt @id is

SubmissionWizard:LOBWizardStepGroup:LineWizardStepSet:WC7LineCoverageScreen:WC7LineCoverageCV:WC7ConditionsDV:6:CoverageInputSet:ConditionInputGroup:PolicyOwnerOfficerLV-body

I cannot use contains also because similarity is there, so I need to handle this numbers before coverageInputSet.

  • 2
    Can you provide the html? – saifur Mar 1 '15 at 15:44
2

If it's just a counter (or another single value) that changes, track it as a variable in your test method and concatinate it.

driver.findElement(By.Xpath("fixed path" + counter + "fixed path 2"));

If that's not enough, check this thread for some other tricks. It's basically the same question as yours.

| improve this answer | |
0

If this is your ID, it is not good for testing anyways. If you cannot use contains, you have to drop the use of ID here and switch to classes and structure. Ask the programmers for test support and let them add meaningful semantic classes.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.