1

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.

enter image description here

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?

1 Answer 1

2

I found the answer myself, the element was supposed to be clicked from the top of its hierarchy:

WebDriverWait(Chromedriver, 240).until(EC.presence_of_element_located((By.XPATH,'//*[@id="individual_member_det"]/div/div/div[6]/select'))).click()
Sign up to request clarification or add additional context in comments.

1 Comment

Usually it's better to use Select() to handle such kind of drop-down menu. Also note that timeout 240 in WebDriverWait(Chromedriver, 240) means that your code will freeze for 4 minutes in case element not found... You might need to decrease this value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.