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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

使用 python selenium 選擇下拉菜單時(shí)沒有輸出

使用 python selenium 選擇下拉菜單時(shí)沒有輸出

郎朗坤 2022-11-18 20:57:39
我想從下拉菜單中選擇所有選項(xiàng)值,但選擇后者時(shí)沒有輸出出現(xiàn)。任何想法為什么會(huì)這樣?網(wǎng)頁代碼:<select class="Combo" id="cmbSecciones" onchange="FiltrarCombos(this,this.item(this.selectedIndex).value);LlenarComboCargo(this,this.item(this.selectedIndex).value)我的代碼:driver = webdriver.Chrome('/Users/Administrador/Documents/chromedriver')main_url = 'https://www.justiciacordoba.gob.ar/Estatico/JEL/Escrutinios/ReportesEleccion20190512/default.html'driver.get(main_url)driver.switch_to.frame("topFrame")dropdown= driver.find_element_by_xpath('//*[@id="cmbSecciones"]')dropdown輸出:<selenium.webdriver.remote.webelement.WebElement (session="34e889c18eb0b5f5dbe6a18d6107389e", element="245e4c6a-e564-460e-9dd9-d678c7028c2d")>
查看完整描述

1 回答

?
搖曳的薔薇

TA貢獻(xiàn)1793條經(jīng)驗(yàn) 獲得超6個(gè)贊

這是因?yàn)槟蛴ebelement的不是選項(xiàng)值。


要獲取所有選項(xiàng)值,請(qǐng)使用此代碼。


dropdown= driver.find_element_by_xpath('//*[@id="cmbSecciones"]')

select_box = Select(dropdown)

for item  in select_box.options:

    print(item.get_attribute('value'))

或者你可以不用select類來打印所有選項(xiàng)


dropdown= driver.find_elements_by_xpath('//*[@id="cmbSecciones"]//option')

for item  in dropdown:

    print(item.get_attribute('value'))


查看完整回答
反對(duì) 回復(fù) 2022-11-18
  • 1 回答
  • 0 關(guān)注
  • 136 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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