擅长:python、mysql、java
<p>有一个<code>iframe</code>。归纳<code>WebDriverWait</code>并首先切换到帧,然后单击按钮。你知道吗</p>
<p><strong>EC.frame\u to \u be \u available \u and \u switch \u to \u it.(EC.frame\u to \u be \u available \u和\u切换到它。)()</strong></p>
<p><strong>EC.element可点击()</strong></p>
<pre><code>from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
driver = webdriver.Chrome(options=options)
driver.get('https://anwb.nl')
WebDriverWait(driver,10).until(EC.frame_to_be_available_and_switch_to_it((By.TAG_NAME,"iframe")))
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.ID,"accept default level"))).click()
</code></pre>