title: Two different elements with same xpath?
body: <p>I am trying to test this website by using JUnit and Selenium:
  <a href="https://www.oanda.com/currency/converter/" rel="nofollow">https://www.oanda.com/currency/converter/</a></p>
  
  <p>I tried to select Unit from “Currency I Have” as well as "Currency I Want". Then I found out that the xpaths are the same. Only the "Currency I Have" codes can be run successfully. "Currency I want" always fail. </p>
  
  <p>The Xpath is <code>driver.findElement(By.xpath("//span[text() = 'GBP']")).click();</code></p>
  
  <p>Could someone help on this? Thanks. </p>
  
  <p>Code1:</p>
  
  <pre><code>public class Currency_I_Have {
      WebDriver driver = new FirefoxDriver();
  
      @Before
      public void setUp() throws Exception {
          driver.manage().window().maximize();
          driver.get("https://www.oanda.com/currency/converter/");
      }
  
      @Test
      public void test() {
          driver.findElement(By.id("quote_currency_input")).click();
  
          driver.findElement(By.xpath("//span[text() = 'GBP']")).click();
          WebElement Amount = driver.findElement(By.id("quote_amount_input"));
          Amount.clear();
          Amount.sendKeys("100");
      }
  }
  </code></pre>
  
  <p>Code2: </p>
  
  <pre><code>public class Currency_I_Want {
      WebDriver driver = new FirefoxDriver();
  
      @Before
      public void setUp() throws Exception {
          driver.manage().window().maximize();
          driver.get("https://www.oanda.com/currency/converter/");
      }
  
      @Test
      public void test() {
          driver.findElement(By.id("base_currency_input")).click();
  
          driver.findElement(By.xpath("//span[text() = 'GBP']")).click();
          WebElement Amount = driver.findElement(By.id("base_amount_input"));
          Amount.clear();
          Amount.sendKeys("200");
      }
  }
  </code></pre>