title: Is there a way to add a new attribute with a value to an element using selenium python?
body: <p>Here's the HTML</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;img src="//www.shahidpro.tv/uploads/articles/220cc817.jpg" width="408" height="605" vspace="" hspace="" border="0" alt=""&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I am trying to add 3 new attributes to make it like</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;img src="//www.shahidpro.tv/uploads/articles/220cc817.jpg" width="408" height="605" vspace="" hspace="" border="0" alt="" style="display: block; margin-left: auto; margin-right: auto;" data-mce-style="display: block; margin-left: auto; margin-right: auto;" data-mce-selected="1"&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>I want to add:</p>
  <ul>
  <li><code>style=&quot;display: block; margin-left: auto; margin-right: auto;&quot;</code></li>
  <li><code>data-mce-style=&quot;display: block; margin-left: auto; margin-right: auto;&quot;</code> and</li>
  <li><code>data-mce-selected=&quot;1&quot;</code></li>
  </ul>
  <p>I tried:</p>
  <pre><code>image = WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.CSS_SELECTOR, &quot;body.mce-content-body#tinymce &gt; p/a/img&quot;)))
  browser.execute_script(&quot;arguments[0].style='display: block; margin-left: auto; margin-right: auto;'&quot;, image)
  browser.execute_script(&quot;arguments[0].data-mce-style='display: block; margin-left: auto; margin-right: auto;'&quot;, image)
  browser.execute_script(&quot;arguments[0].data-mce-selected='1'&quot;, image)     ` but got no results nor errors
  </code></pre>