title: How to change element class attribute value using selenium
body: <p>I lost my credentials.. so I'm creating this new thread. The old question it here if it helps: <a href="https://stackoverflow.com/questions/39424703/how-to-click-a-button-to-vote-with-python">How to click a button to vote with python</a></p>
  
  <p>I'd like to change this line:</p>
  
  <pre><code>&lt;a data-original-title="I&amp;nbsp;like&amp;nbsp;this&amp;nbsp;faucet" href="#" class="vote-link up" data-faucet="39274" data-vote="up" data-toggle="tooltip" data-placement="top" title=""&gt;&lt;span class="glyphicon glyphicon-thumbs-up"&gt;&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>&lt;a data-original-title="I&amp;nbsp;like&amp;nbsp;this&amp;nbsp;faucet" href="#" class="vote-link up voted" data-faucet="39274" data-vote="up" data-toggle="tooltip" data-placement="top" title=""&gt;&lt;span class="glyphicon glyphicon-thumbs-up"&gt;&lt;/span&gt;&lt;/a&gt;
  </code></pre>
  
  <p>So that the vote is set changing <code>vote-link up</code> to <code>vote-link up voted</code>.</p>
  
  <p>But the problem is that in that site, there are severals items to vote, and the element "data-faucet" changes. If I use this script:</p>
  
  <pre><code>from selenium import webdriver
  
  driver = webdriver.Firefox()
  driver.get("linkurl")
  element = driver.find_element_by_css_selector(".vote-link.up")
  element_attribute_value = element.get_attribute("data-faucet")
  if element_attribute_value == "39274":
      print ("Value: {0}".format(element_attribute_value))
  driver.quit()
  </code></pre>
  
  <p>But it obsiusly doesn't print anything, cause the first attribute value has another number. How can I select my line with the input of the number of <code>data-faucet</code> element, so I can replace it with <code>vote-link up voted</code>?</p>
  
  <p>I only can do this selenium? Is there another way without using a real browser?</p>
  
  <p>Anyway, this is the structure of the webpage:</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body role="document"&gt;
  &lt;div id="static page" class="container-fluid"&gt;
  &lt;div id="page" class="row"&gt;&lt;/div&gt;
  &lt;div id="faucets-list"&gt;
  &lt;tbody&gt;
  &lt;tr class=""&gt;&lt;/tr&gt;
  &lt;tr class=""&gt;&lt;/tr&gt;
  &lt;tr class=""&gt;&lt;/tr&gt;
  &lt;tr class=""&gt;&lt;/tr&gt;
  # an infinite number of nodes, until there's mine
  &lt;tr class=""&gt;
  &lt;td class="vote-col"&gt;
  &lt;div class="vote-box"&gt;
  &lt;div class="vote-links"&gt;
  &lt;a class="vote-link up" data-original-title="I like this faucet" href="#" data-faucet"39274" data-vote"up" data-toggle"tooltip" data-placement="top" title=""&gt;&lt;/a&gt;
  </code></pre>
  
  <p>The site is this: <a href="https://faucetbox.com/en/list/BTC" rel="noreferrer">https://faucetbox.com/en/list/BTC</a></p>