title: Selenium Python bindings: how to execute JavaScript on an element?
body: <p>Have used python selenium script to trigger selenium server to run JavaScript code. It works fine.</p>
  
  <pre><code>drv.execute_script('&lt;some js code&gt;')
  </code></pre>
  
  <p>However, I can't figure out how to run javascript code on an element that was retrieved using get_element_by_*() api.    For example, I </p>
  
  <pre><code>ele = get_element_by_xpath('//button[@id="xyzw"]');
  #question: how do I change the "style" attribute of the button element?
  </code></pre>
  
  <p>If I were on developer console of the browser, I can run it as </p>
  
  <pre><code>ele = $x('//button[@id="xyzw"]')[0]
  ele.setAttribute("style", "color: yellow; border: 2px solid yellow;")
  </code></pre>
  
  <p>Just don't know how to do it in python selenium script. 
  Thanks in advance. </p>