0

I'm writing a Python program (with Selenium) to automatically download data from a website and then log out, but cannot figure out how to get to the logout menu item, which is in a drop-down list. I'm a NOOB at this, so please bear with me.

I've reviewed a number of posts here to see if I could sort it out (including this one), to no avail.

Here is the HTML code; the item that renders the dropdown list is highlighted. No matter what I try, Selenium either cannot find the item I need to click or it finds the item and says it's not clickable. How do I get the dropdown menu to appear so I can click on the "Logout" list item?

enter image description here

Once I get the dropdown menu to appear, I need to select the item with an ID of "logout" in the HTML code below. What is the proper way to do this?

enter image description here

1 Answer 1

0

After playing around a bit, I found a solution that worked:

menu = driver.find_element(By.XPATH, "//div[@class='grid__item one-half right-side']/ul/li[3]").click()
lo = driver.find_element(By.ID, "logout").click()

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.