简体   繁体   中英

select a dropdown box using Selenium python

I am having trouble selecting a particular dropdown element via Selenium. The website is password protected so I have shared a snapshot of it. The attached snapshot shows what is visible when I right-click on the element and choose 'Inspect'. I am selecting XPATH which I have pasted in the pictures address bar to show what it is. Then I use the following line in my script to click it but it says element is not visible.

在此处输入图片说明

WebDriverWait(Chromedriver, 240).until(EC.presence_of_element_located((By.XPATH, '//*[@id="dateRangeType"]'))).click()

I have noticed that this element does not have a class to it. If that is the reason it is not working, how would I select an element with id, name but no class?

我自己找到了答案,该元素应该从其层次结构的顶部单击:

WebDriverWait(Chromedriver, 240).until(EC.presence_of_element_located((By.XPATH,'//*[@id="individual_member_det"]/div/div/div[6]/select'))).click()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM