title: setting attribute value selenium python
body: <p><a href="https://i.stack.imgur.com/EIHvY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/EIHvY.png" alt="enter image description here"></a></p>
  
  <p>In this example, this is a database table that changes dynamically depending on how many records you select to display. I am creating a script that runs through each row to grab data, however, if you go into a specific record, or refresh the page the view resets each time to page 1. So for example, if you were on page 5 and hit refresh, the page will refresh the view to page 1.</p>
  
  <p>My work around is to pass in the value of 500 and then select the option where the value will be 500. This will increase the results to show all on one page so that I don't have to refresh the page.</p>
  
  <p>I am trying to access option value 50 to change it to the value of 500. Then I will use the <code>.click()</code> method to change the view to this value.</p>
  
  <p>I have tried to use this way with no luck.</p>
  
  <pre><code>driver.execute_script("document.getElementById('dt_a_length').getElementsByTagName('option').setAttribute('value', '500')")
  </code></pre>
  
  <p>I would greatly appreciate some help with this. Thank you!</p>