title: Selenium Set Attribute is not working when trying to execute the script
body: <p>I want to get set the date filter value on the webpage <a href="https://www.icc-cricket.com/rankings/mens/player-rankings/odi/batting" rel="nofollow noreferrer">https://www.icc-cricket.com/rankings/mens/player-rankings/odi/batting</a> but I'm not able to do so. I have tried setting the value of the attribute but not getting the final result. The element is as shown below:</p>
  <pre><code>&lt;div class=&quot;drop-down__current js-drop-down-current&quot; data-value=&quot;2022&quot;&gt;  2022 &lt;/div&gt;
  </code></pre>
  <p>Here, I want to change the value of 'data-value' to my desired year. The code that I have been using is as given below:</p>
  <pre><code>from bs4 import BeautifulSoup
  import pandas as pd
  import requests
  import re
  import datetime
  import os
  import selenium
  from selenium import webdriver
  from selenium.webdriver.chrome.options import Options
  from selenium.webdriver import Chrome
  from selenium.webdriver.common.keys import Keys
  from selenium.webdriver.support.ui import Select
  date_list = pd.date_range(start = &quot;2022-02-01&quot;, end=datetime.date.today(), freq='1d')
  PATH = &quot;C:\Program Files (x86)\chromedriver&quot;
  driver = webdriver.Chrome(PATH)
  
  url = 'https://www.icc-cricket.com/rankings/mens/player-rankings/odi'
  driver.get(url)
  l = driver.find_element_by_xpath(&quot;/html/body/main/div/div[2]/div/div/section[1]/div[2]/div[1]/div/div[2]/a&quot;)
  driver.execute_script(&quot;arguments[0].click();&quot;, l)
  
  for date in date_list:
      year = date.year
      month = date.month
      day = date.day
      drop1 = driver.find_element_by_xpath(&quot;/html/body/main/div/div[2]/div/div/section/div[1]/div/div[1]/div[1]/div[3]&quot;)
      # driver.execute_script(&quot;arguments[0].click();&quot;, drop1)
      driver.execute_script(f&quot;arguments[0].setAttribute('data-option',{year})&quot;,drop1)
      print(driver.find_element_by_xpath(&quot;/html/body/main/div/div[2]/div/div/section/div[1]/div/div[1]/div[1]/div[3]&quot;).text)
      
  </code></pre>
  <p>And the output is</p>
  <pre><code>Please select
  Please select
  Please select
  </code></pre>
  <p>I am not able to understand where I am going wrong. Any help will be much appreciated.</p>