title: Appium Collecting all the text on any screen
body: <p>I am working on translation automation for an app (iOS and android appium version 1.7.0) . Meaning i am supposed to go through all the pages of the app then I am using gcloud api to identify the language.</p>
  
  <p>I need help finding an <strong>effective</strong> way to collect all the text displayed on a certain screen.</p>
  
  <p>Currently I am using this approch as in the code below :</p>
  
  <ol>
  <li>I find all the elements on the page</li>
  <li><p>I get the ones with Text attributes</p>
  
  <pre><code>public void displayText()
  {
  
      System.out.println("i will display all the text and each of their languages");
  
      // I find all the elements on the page as such
      List&lt;MobileElement&gt; list = driver.findElements(By.xpath("//*"));
  
  
      assertTrue(list.size()&gt;0) ;
  
      System.out.println(list.size());
  
      //foreach of the elements detected I determine the language
  
  
  
      for(int i=0;i&lt;list.size();i++)
      { if (list.get(i).getText()!= null) {
          String SeenText = list.get(i).getText();
          System.out.println(SeenText);
  
          //Lang detection
  
      List&lt;Detection&gt; detections 
      =translate.detect(ImmutableList.of(list.get(0).getText()));
      System.out.println("Language(s) detected:");
      for (Detection detection : detections) {
      System.out.printf("\t%s\n", detection);}
  
  
      }}
  
  System.out.println(driver1.getPageSource());
  </code></pre></li>
  </ol>
  
  <p>However this is only working for pages with few elements. It takes so much time for content heavy paged that the appium session times out.</p>
  
  <p>I have considered manually parsing the outcome of "driver.getPageSource())" But I am not sure if that is reliable.</p>
  
  <p>Any ideas on a better and functional way to get all the text in a screen?</p>
  
  <p>Thans!</p>