第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

python selenium錯誤陳舊元素:元素未附加到頁面文檔

python selenium錯誤陳舊元素:元素未附加到頁面文檔

人到中年有點甜 2021-04-04 12:13:23
我正在嘗試從一個名為Correios的網(wǎng)站獲取所有數(shù)據(jù),在此網(wǎng)站中,我需要處理一些下拉菜單,這些菜單出現(xiàn)一些問題,例如:它無法從第一個下拉框信息中獲取所有值。from selenium import webdriverfrom selenium.webdriver.support import expected_conditions as ECfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support.select import Selectchrome_path = r"C:\\Users\\Gustavo\\Desktop\\geckodriver\\chromedriver.exe"driver = webdriver.Chrome(chrome_path)lista_x = []driver.get("http://www2.correios.com.br/sistemas/agencias/")driver.maximize_window()estado_select = Select(driver.find_element_by_id('estadoAgencia'))WebDriverWait(driver, 20).until(EC.presence_of_element_located((By.ID, 'municipioAgencia')))municipio_select = Select(driver.find_element_by_id('municipioAgencia'))for opt in estado_select.options:    print(opt.get_attribute('innerHTML'))    opt.click()    for opt2 in municipio_select.options:        print(opt.get_attribute('innerHTML'))        opt2.click()driver.close()有時我的代碼運行正常,但有時卻出現(xiàn)此錯誤:ACREACREALAGOASALAGOASTraceback (most recent call last):  File "C:\Users\Gustavo\Desktop\insper\trabalho\Correios3.py", line 23, in <module>    opt2.click()  File "C:\Users\Gustavo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 80, in click    self._execute(Command.CLICK_ELEMENT)  File "C:\Users\Gustavo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 628, in _execute    return self._parent.execute(command, params)  File "C:\Users\Gustavo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 320, in execute    self.error_handler.check_response(response)  File "C:\Users\Gustavo\AppData\Local\Programs\Python\Python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response    raise exception_class(message, screen, stacktrace)我應(yīng)該怎么辦?
查看完整描述

2 回答

  • 2 回答
  • 0 關(guān)注
  • 368 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號