title: Looking for 2 things in 2 different Xpaths - Python Selenium
body: <p>I am working on a bot for a website and it requires a color and keyword to find the item. I am using selenium to look for the item from the keyword and then pick a color option (some items on the website, provide the item in multiple colors). I am having trouble looking for both the keyword and color at the same time, and then after choosing the correct colored version of the item from the user's color and keyword input. I want it to select on that option.</p>
  
  <p>Formula I am trying to make in Python:</p>
  
  <pre><code> If the first Xpath(keyword) is found and the 2nd Xpath(color) is found
   Then select on the item that contains those 2 properties.
  </code></pre>
  
  <p>This is the current code I have:</p>
  
  <pre><code> Item = driver.find_element_by_xpath('//*[contains(text(), "MLK")]' and contains ("Black")]')
  
  if (item != None):
      actions.moveToElement(item).click()
  </code></pre>
  
  <hr>
  
  <p>I've tried the code above and it doesn't work.</p>
  
  <p>Here are the 2 pieces of code that I want to merge to find the item:</p>
  
  <ol>
  <li><p><code>driver.find_element_by_xpath('//a[contains(text(), "MLK")]')</code></p></li>
  <li><p><code>driver.find_element_by_xpath('//a[contains(text(), "Black")]')</code></p></li>
  </ol>
  
  <p>The keyword is called <code>MLK</code></p>
  
  <h2>The Color is called <code>Black</code></h2>
  
  <p>After Merging, I want to find that Exact Element (Called MLK, Color version = Black)</p>
  
  <p>This combined item should be clicked on, I only know to use <code>.click()</code>
  If a better way, please let me know.</p>
  
  <hr>
  
  <p>The website I am using to make a bot for: <code>supremenewyork.com</code>
  The item I am using as an example, to pick a certain color (It's the Sweatshirt with MLK on it): <a href="http://www.supremenewyork.com/shop/all/sweatshirts" rel="nofollow noreferrer">http://www.supremenewyork.com/shop/all/sweatshirts</a></p>