title: I want to get a text from a page which is changed after login selenium java
body: <p>I want to get a text from a page which will be opened after I login, but I don't have an idea how to do so, currently the URL is <code>https://www.tdscpc.gov.in/app/login.xhtml</code> after login, it opens a page <code>https://www.tdscpc.gov.in/app/</code> so I want to get a Text from the second page,
  thanks</p>
  <pre><code> static WebDriver driver = new ChromeDriver();
      public static void main(String[] args) throws InterruptedException {
          String exePath = &quot;C:\\Users\\Dell\\Downloads\\chromedriver_win32 (1)\\chromedriver.exe&quot;;
          System.setProperty(&quot;webdriver.chrome.driver&quot;, exePath);
          driver = new ChromeDriver();
  
          driver.get(&quot;https://www.tdscpc.gov.in/app/login.xhtml&quot;);
          driver.findElement(By.xpath(&quot;/html/body/div[1]/form/div[2]/div[2]/div[2]/div[2]/div[3]/table/tbody/tr/td[1]/input&quot;))
                  .click();
          driver.findElement(By.xpath(&quot;/html/body/div[1]/form/div[2]/div[2]/div[2]/div[2]/div[4]/p[2]/input&quot;))
                  .sendKeys(&quot;*******&quot;);
          driver.findElement(By.xpath(&quot;/html/body/div[1]/form/div[2]/div[2]/div[2]/div[2]/div[6]/p[2]/input&quot;))
                  .sendKeys(&quot;*******&quot;);
          driver.findElement(By.xpath(&quot;/html/body/div[1]/form/div[2]/div[2]/div[2]/div[2]/div[8]/p[4]/input[3]&quot;)).
                  sendKeys(&quot;*******&quot;);
          driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
          while (driver.findElement(By.xpath(&quot;/html/body/div[1]/form/div[2]/div[2]/div[2]/div[2]/div[12]/p[2]/input&quot;)).o) {
  
  //This is the value which is on the new page, i want to get this value from the page, the page opens automatically once login is done, i just want to get this element froom a page which opens after login (Like the Dashboard) 
              String name = driver.findElement(By.xpath(&quot;/html/body/div[1]/div[3]/text()&quot;)).getText();
              String nameInReplace = name.replace(&quot;Welcome &quot;, &quot;&quot;);
              System.out.println(nameInReplace);
          }
      }
  </code></pre>
  <p>Edit2-
  I Think that the Driver is getting the Element from the first URL, which is invalid as the element is not present there, how do i change it so it detects it from the new page and not the first page?</p>