title: Selenium Java - How to Select a Dropdown Element that Has No ID
body: <p>I am using Selenium - Java WebDriver (ChromeDriver) as a new user.</p>
  
  <p>While trying to select an item from a dropdown menu using Java, I couldn't do it because of the error message. Please note that I've tried variations of Select and WebElement options but not having the expected result: clicking the link from the drop down menu that should take me to the target page.</p>
  
  <p>Here is the error message shown in eclipse: </p>
  
  <p>Exception in thread "main" org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"link text","selector":"Payment"}</p>
  
  <p>Here is the relevant code segment: </p>
  
  <pre><code>Select dropdown2 = new Select(webDriver.findElement(By.linkText("Payment")));
  dropdown2.selectByVisibleText("Payment");
  </code></pre>
  
  <p>I have also tried the following with no success: </p>
  
  <pre><code>WebElement element = webDriver.findElement(By.cssSelector("a[class='glyphicon glyphicon-credit-card']"));
  element.click();
  </code></pre>
  
  <p>Also, the following code that didn't work:</p>
  
  <pre><code>WebElement element = webDriver.findElement(By.partialLinkText("Payment"));
  Select mySelect= new Select(element);
  mySelect.selectByVisibleText("Payment");
  </code></pre>
  
  <p>The segment of html is shown below: </p>
  
  <p><a href="https://i.stack.imgur.com/UVplY.jpg" rel="nofollow"><img src="https://i.stack.imgur.com/UVplY.jpg" alt="code segment"></a></p>
  
  <p>Hoping to get feedback.</p>
  
  <p>Thank you.</p>