1
votes

I am trying to automate regression tests using the new selenium ide version 3.13. I wanted to get dynamic values and not hard code my values. I have a table which i want to loop through and then click on the element. I been trying everything but nothing works all i see is examples from the old selenium ide when "store eval" was a command. please can you run me step by step on how to achieve this with the new selenium ide.

I have tried the following: 1. get the element that highlights all the rows i want to click on 2. now i just need to know how to iterate it one element at a time within the table going down. click verify text and move on to the next one click verify text.

My xpath:xpath=/html/body/div[4]/tracer-app/div[3]/div[4]/div[3]/ng-component/form/div/div[2]/div/questions-library/div/div[2]/div[1]/div

            </a>
            <!--template bindings={}--><a _ngcontent-csk-87="" class="list-group-item">
                Accreditation Participation Requirements Question Library
            </a><a _ngcontent-csk-87="" class="list-group-item">
                Behavioral Health Care Inpatient
            </a><a _ngcontent-csk-87="" class="list-group-item lib-selected">
                Cardiac and Pulmonary Rehabilitation
            </a><a _ngcontent-csk-87="" class="list-group-item">
                Central Venous Catheter Audit
            </a><a _ngcontent-csk-87="" class="list-group-item">
                Chemotherapy Administration
            </a><a _ngcontent-csk-87="" class="list-group-item">
                CLABSI Prevention
            </a><a _ngcontent-csk-87="" class="list-group-item">
                Clinical Alarm Safety
            </a><a _ngcontent-csk-87="" class="list-group-item">
                Clinical Alarm Safety - Telemetry
            </a><a _ngcontent-csk-87="" class="list-group-item">
                Complaint and Grievance - Deemed Status
            </a><a _ngcontent-csk-87="" class="list-group-item">
                Contracted Services

Expected results: click on each template, verify text and move on to the next element verify text in a loop.

1

1 Answers

2
votes

Here is my code:enter image description here I've used while command to make a loop with i as iterator.

To switch between links I've put i iterator inside xpath - //div[@class='main-navbar']/div/ul/li[${i}]/a (6 row on the pic)

I have exepexted_values array that contains tab names that I expect to find on the page. So in the 12th row I check tab name with the value from this array. Then I increase my iterator and start all over again.