title: How to handle multiple indexes in numerical order
body: <p>I am making a bot for instagram that will automatically send messages out to my followers. I want it to message everyone but, I am not sure on how to do that.</p>
  
  <p>Here is my code</p>
  
  <pre><code>@Test
  public void SimpleTest() throws InterruptedException { //
  
  driver.findElement(By.id("com.instagram.android:id/log_in_button")).click();
  
  
  By path = By.xpath("//*[@text='Phone number, email or username']");
  driver.findElement(path).sendKeys("draco_boys");
  Thread.sleep(5000);
  </code></pre>
  
  <p><code>driver.findElement(By.id("com.instagram.android:id/password")).sendKeys("xxxxxxxx");</code>
      <code>Thread.sleep(5000);</code></p>
  
  <pre><code>driver.findElement(By.id("com.instagram.android:id/next_button")).click();
  Thread.sleep(5000);
  
  By path2 = By.xpath("//android.widget.FrameLayout/android.widget.LinearLayout/android.widget.ImageView[@index='3']"); 
  Thread.sleep(7000);
  driver.findElement(path2).click(); 
  Thread.sleep(5000);
  
  By path3 = By.xpath("//android.widget.LinearLayout[@index='1']"); //first person in my messages
  driver.findElement(path3).click(); 
  
  By path4 = By.xpath("//*[@text='Message…']");
  driver.findElement(path4).sendKeys("Hello");
  </code></pre>
  
  <p><code>driver.findElement(By.id("com.instagram.android:id/row_thread_composer_button_send")).click();</code></p>
  
  <pre><code>driver.findElement(By.id("com.instagram.android:id/action_bar_button_back")).click();
  }
  
  
  }
  </code></pre>
  
  <p>After it has messaged the first person in my messages, I want it to go back and do the same for the second person, for the third person, and so on. Does anyone know what command I could use? </p>