如何根據leafletjs從地圖彈出框中獲取文本。該url is this。我也得到這個錯誤:NoSuchElementExceptionPython Selenium - 從LeafletJS彈出框和NoSuchElementException中獲取文本
如果我搜索了包裹並輸入了相關信息,如下所示,那麼我想要獲得包含class_name的所有文本:'leaflet-popup-content'?
# Creates an instance driver object...
driver = webdriver.Chrome()
# load the url above
driver.get(url)
# =============
# Find and fill SEARCH BOX by id....
driver.find_element_by_id('searchBox').send_keys('1083CX')
# Send the form by clicking on the searcht botton...
driver.find_element_by_id('searchButton').click()
driver.find_element_by_id('listElementContent0').click()
# driver.find_element_by_class_name('content').click()
# =============
txt = driver.find_element_by_class_name('leaflet-popup-content').text()
print (txt)
這個問題在What is the best way to avoid NoSuchElementException in Selenium?的問題使用Java,我不明白。我正在使用Python,並且對所有這些都是新的?
的可能的複製[在Selenium中避免NoSuchElementException的最佳方法是什麼?](http://stackoverflow.com/questions/19536954/what-is-the-best-way-to-avoid-nosuchelementexception-in-selenium) –