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

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

在python中使用硒選擇復(fù)選框

在python中使用硒選擇復(fù)選框

溫溫醬 2022-06-28 17:26:04
我想在 python 中使用 selenium 選擇一個(gè)復(fù)選框。以下是復(fù)選框的 HTML。將鼠標(biāo)懸停在復(fù)選框上時(shí),跨度元素會突出顯示HTML<div id="rc-anchor-container" class="rc-anchor rc-anchor-normal rc-anchor-light">    <div id="recaptcha-accessible-status" class="rc-anchor-aria-status" aria-hidden="true">Recaptcha requires verification. </div>    <div class="rc-anchor-error-msg-container" style="display:none"><span class="rc-anchor-error-msg" aria-hidden="true"></span></div>    <div class="rc-anchor-content">        <div class="rc-inline-block">            <div class="rc-anchor-center-container">                <div class="rc-anchor-center-item rc-anchor-checkbox-holder"><span class="recaptcha-checkbox goog-inline-block recaptcha-checkbox-unchecked rc-anchor-checkbox" role="checkbox" aria-checked="false" id="recaptcha-anchor" tabindex="0" dir="ltr" aria-labelledby="recaptcha-anchor-label"><div class="recaptcha-checkbox-border" role="presentation"></div><div class="recaptcha-checkbox-borderAnimation" role="presentation"></div><div class="recaptcha-checkbox-spinner" role="presentation"></div><div class="recaptcha-checkbox-spinnerAnimation" role="presentation"></div><div class="recaptcha-checkbox-checkmark" role="presentation"></div></span></div>            </div>        </div>        <div class="rc-inline-block">            <div class="rc-anchor-center-container">                <label class="rc-anchor-center-item rc-anchor-checkbox-label" aria-hidden="true" role="presentation" id="recaptcha-anchor-label"><span aria-live="polite" aria-labelledby="recaptcha-accessible-status"></span>I'm not a robot</label>            </div>        </div>    </div>    <div class="rc-anchor-normal-footer">        <div class="rc-anchor-logo-portrait" aria-hidden="true" role="presentation">            <div class="rc-anchor-logo-img rc-anchor-logo-img-portrait"></div>            <div class="rc-anchor-logo-text">reCAPTCHA</div>        </div>我正在嘗試以下代碼,但它給出了以下異常selenium.common.exceptions.NoSuchElementException
查看完整描述

1 回答

?
繁花如伊

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

這是一個(gè) recaptha 的東西 .. 它不像頁面中的普通元素


您必須使用 selenium 導(dǎo)航到驗(yàn)證碼框架..然后您可以處理復(fù)選框元素..


為此,您需要先保存主窗口句柄,以便在完成 recaptcha 后返回它


# save the main window handle

mainwindow = browser.current_window_handle


# get the recapthca iframe then navigate to it

frame = browser.find_element_by_tag_name("iframe")  

browser.switch_to.frame(frame)


# now you can access the checkbox element 

browser.find_element_by_id("recaptcha-anchor").click()


# navigate back to main window

browser.switch_to.window(mainwindow)

有關(guān)如何處理 recaptcha 挑戰(zhàn)的更多信息,請查看此鏈接


查看完整回答
反對 回復(fù) 2022-06-28
  • 1 回答
  • 0 關(guān)注
  • 115 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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