0

here I want to select an element from a dropdown. I don't know how to do it! I used XPATH but it doesn't work. Could you do me a favor and help me how can I select it by selenium in python? I want to chose Import in the dropdown. sorry I am totally beginner.

chrome_options = Options()
chrome_options.add_argument("--no-sandbox")
webdriver_service = Service('C:\Webdriver\chromedriver.exe') ## path to where you saved chromedriver binary
browser = webdriver.Chrome(service=webdriver_service, options=chrome_options)
url = 'http://www.kita.org/kStat/byCom_AllCount.do'
browser.get(url)
time.sleep(5)

select = Select(WebDriverWait(browser, 20).until(EC.element_to_be_clickable((By.XPATH, '//*[@id="stat_0203"]/table/tbody/tr/td/table/tbody/tr/td/form/table/tbody/tr/td/table[3]/tbody/tr/td/table/tbody/tr/td/table/tbody/tr[1]/td[2]/select'))))
select.select_by_index(2)

enter image description here

Va SA
  • 375
  • 1
  • 9
  • @ I have tried according to the page you sent it but It doesn't help me. I don't know why – Va SA Sep 13 '22 at 14:17
  • There are tons of topics about selecting the drop list options. Just google it and try them. – Prophet Sep 13 '22 at 14:19
  • Do you have another account on this site? @saiedvaygani – Barry the Platipus Sep 13 '22 at 18:09
  • Yes, you did have an account @saiedvaygani, and it was for some reasons closed. This question was asked on your old account: https://stackoverflow.com/questions/73222491/how-to-drop-down-an-element-by-python-with-selenium/73223202#73223202 Were you banned from this site, saied? I remember you asking a lot of questions which were closed. – Barry the Platipus Sep 13 '22 at 18:21
  • @Barry the Platipus. Yes Barry I have two accounts. – Va SA Sep 14 '22 at 05:37
  • @Barry the Platipus yes. I remember you you finally made a program to solve my problem. That website belong to the Canadian custom center. It is for United Kingdom custom center. I will edit the my program here according to your guidance. May you help me here? – Va SA Sep 14 '22 at 06:23

0 Answers0