[selenium]元素在 iframe 中,无法点击

发布时间 2023-06-20 17:07:53作者: *飞飞*

 

driver.switch_to.frame(driver.find_element(By.CSS_SELECTOR,'iframe'))      #跳转到iframe  
time.sleep(5)

InputButton = driver.find_element(By.LINK_TEXT,'GO')    #在iframe中定位到元素
driver.execute_script('arguments[0].click();',InputButton)    #点击元素
time.sleep(5)