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: programmerworld1990@gmail.com
Code:
driver.get("web page url");
driver.findElement(By.xpath("//div[@data-testid=\"home-page-travellers\"]")).click();
for(int i=1;i<6;i++)
{
driver.findElement(By.xpath("//div[@data-testid=\"Adult-testID-plus-one-cta\"]")).click();
}