This error message...
UnexpectedTagNameException: Message: Select only works on <select> elements, not on <div>
...implies that your program invoked Select()
on a <div>
element, where as Select()
works only with html-select tags.
Solution
The Country dropdown within the website https://vizhub.healthdata.org/tobacco/ can be accessed through:
Snapshot:

So to select China from the Country dropdown a possible solution should have been:
driver.get("https://vizhub.healthdata.org/tobacco/")
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//img[@id='data']"))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//a[@class='select2-choice']/span"))).click()
WebDriverWait(driver, 20).until(EC.element_to_be_clickable((By.XPATH, "//ul[@class='select2-results']//div[@class='select2-result-label' and text()='China']"))).click()
tl; dr
However, the solution didn't work at my end and when I went ahead and inspected the DOM Tree of the webpage it was observed that some of the <script>
tag refers to JavaScripts having keyword dist. As an example:
<script type="text/javascript" src="https://unpkg.com/react-dom@15.6.2/dist/react-dom.min.js"></script>
<script type="text/javascript" src="https://unpkg.com/ihme-ui@0.34.0/dist/ihme-ui.js"></script>
<script type="text/javascript" src="https://unpkg.com/clipboard@1.7.1/dist/clipboard.min.js"></script>
<link type="text/css" rel="stylesheet" href="https://unpkg.com/ihme-ui@0.34.0/dist/ihme-ui.css">
Which is a clear indication that the website is protected by Bot Management service provider Distil Networks and the navigation by Selenium driven ChromeDriver initiated google-chrome Browsing Context gets detected and subsequently gets blocked.
Distil
As per the article There Really Is Something About Distil.it...:
Distil protects sites against automatic content scraping bots by observing site behavior and identifying patterns peculiar to scrapers. When Distil identifies a malicious bot on one site, it creates a blacklisted behavioral profile that is deployed to all its customers. Something like a bot firewall, Distil detects patterns and reacts.
Further,
"One pattern with Selenium was automating the theft of Web content"
, Distil CEO Rami Essaid said in an interview last week. "Even though they can create new bots, we figured out a way to identify Selenium the a tool they're using, so we're blocking Selenium no matter how many times they iterate on that bot. We're doing that now with Python and a lot of different technologies. Once we see a pattern emerge from one type of bot, then we work to reverse engineer the technology they use and identify it as malicious".
Reference
You can find a couple of detailed discussion in: