Back to Browse

Selenium: Looping concept, how to implement loop in selenium script?

8.4K views
Jan 29, 2023
16:36

In this video we will see how to apply loops in order to maintain the code quality. When same action is expected to perform again and again instead of writing same code multiple times better to use loop. I hope you like this video. For any questions, suggestions or appreciation please contact us at: https://programmerworld.co/contact/ or email at: [email protected] Details also available in below: https://programmerworld.co/selenium/selenium-looping-concept-how-to-implement-loop-in-selenium-script/ Code: driver.get("web page url"); driver.findElement(By.xpath("//div[@data-testid=\"home-page-travellers\"]")).click(); for(int i=1;i LESS_THAN 6;i++) { driver.findElement(By.xpath("//div[@data-testid=\"Adult-testID-plus-one-cta\"]")).click(); }

Download

0 formats

No download links available.

Selenium: Looping concept, how to implement loop in selenium script? | NatokHD