0
votes

There are two dropdown element code: one is standard option-select and the other is made of div, ul, li elements.

And somehow both are used to select a dropdown element via javascript...

Problem is selenium is not able to click the element and throws not visible exception.....

See the dropdown box here: [Its below "Top 5" tab] http://www.oddsbox.com/baseball/mlb/record/section.odd

Following solutions don't help either: Python Selenium: Find object attributes using xpath selecting element in python selenium Selenium nested li div menu select() or click() python how to select custom dropdown list element from selenium

1
which one you are talking about? the page is in Korean. Can you be more specific? Where is your own code? - Yu Zhang
Could you share your code which have tried as well?? - Saurabh Gaur

1 Answers

1
votes

It would be nice if you'd post your code, so we can see a bit clearer what's happening. Also admitted, I did not check all of your links to see everything that doesn't work. However my guess is this:

If you get an ElementNotVisible exception, then you should probably make your element visible before selecting it.

In this case I'd forget about the selecting commands and all and just : - click on the element to open and reveal the menu and then - click on the desired element inside that list.

Looks something like :

driver.find_element_by_xpath(".//*[@id='ctmSelectBox4_wrap']/button").click()
driver.find_element_by_xpath(".//*[@id='ctmSelectBox4_wrap']/div/ol/li[6]/label/span").click()

I personally detest these ugly xpaths (especially for maintainability), and probably would change that somehow, but that's not the scope of this question.

Hope that helps!