0
我试图点击网页的一部分,但我收到消息“NoSuchElementException:无法找到元素”....尽管元素在那里。Python Selenium:找不到Xpath元素
该代码用于工作,但它看起来像页面发生了变化..但xpath没有改变。
我在这里尝试了Stackoverflow中类似问题的不同解决方案,但对于这个例子还是有些不正确。
元素我真的试图点击 “下载德Arquivos”
我的代码:
from selenium import webdriver
fp = webdriver.FirefoxProfile()
fp.set_preference("browser.download.folderList",2)
fp.set_preference("browser.download.manager.showWhenStarting",False)
fp.set_preference("browser.helperApps.neverAsk.saveToDisk", "application/msword, application/csv, application/vnd.ms-excel, application/ris, text/csv, image/png, application/pdf, text/html, text/plain, application/zip, application/x-zip, application/x-zip-compressed, application/download, application/octet-stream")
fp.set_preference('browser.helperApps.alwaysAsk.force', False)
driver = webdriver.Firefox(firefox_profile=fp)
driver.get("http://www.bmfbovespa.com.br/pt_br/servicos/market-data/consultas/mercado-a-vista/codigo-isin/pesquisa/")
###
# Click "Download de arquivos" (the part with problem)
###
elem=driver.find_element_by_xpath(".//*[@id='ctl00_contentPlaceHolderConteudo_rtsDetalhe_tabDownload']/span/span")
elem.click()
有什么想法?
我都尝试....但我仍然得到“NoSuchElementException异常:找不到元素”的消息。 – fmarques
@fmarques好的,更新,检查出来。 – alecxe
它的工作原理!非常感谢你! – fmarques