title: Selenium: Get Attribute Value Based on Visible Text?
body: <p>I'm using Java and Selenium. I know I could get visible text using the getText() method/ For example, if I supply the ID (via XPath or CSS) I could do getText() on this to get visible text. But what if I want to do the opposite. Let's say I know what the visible text is and I want to use the text to find another attribute? For example, let's say I have the following HTML markup:</p>
  
  <pre><code>&lt;div class="" title="Card"/&gt;
  &lt;div id="99999cardName" class="cardName editInline" title="Click to edit"&gt;ZZZ&lt;/div&gt;
  &lt;div id="99999cardNumber" class="cardNumber"&gt;4590 6565 6565 6565&lt;/div&gt;
  </code></pre>
  
  <p>In this example, suppose I knew the value <code>4590 6565 6565 6565</code> and I wanted to get the value <code>99999cardNumber</code> - how would I do it?</p>
  
  <p>Thanks</p>