亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

無法單擊彈出窗口中的子按鈕

無法單擊彈出窗口中的子按鈕

當年話下 2023-12-20 16:04:08
我對硒有疑問:我無法單擊由我單擊的第一個按鈕生成的彈出窗口中包含的按鈕。    from selenium import webdriver    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.webdriver.firefox.options import Options    # Webdriver    browser = webdriver.Chrome('C:\\Users\\zlell\\PycharmProjects\\PyroLello\\Userbot\\chromedriver.exe')    browser.get("https://www.eventbrite.com/e/120621788015")    # This button originates a pop-up    python_button = browser.find_element_by_xpath('//*[@id="eventbrite-widget-modal-trigger-120621788015"]')    # Click    python_button.click()    # The pop-up with the new button appears    # Try to find the button included in the pop-up - Doesn't work    python_button_2 = browser.find_element_by_css_selector("button.eds-btn.eds-btn--button.eds-btn--fill")    # Click - Doesn't Work    python_button_2.click()
查看完整描述

1 回答

?
慕田峪7331174

TA貢獻1828條經驗 獲得超13個贊

添加頁面加載后的等待。抓住 iframe 并切換到它。


iframe = WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.TAG_NAME, "iframe")))

browser.switch_to.frame(iframe)

python_button_2 =WebDriverWait(browser, 10).until(EC.presence_of_element_located((By.CSS_SELECTOR, "button.eds-btn.eds-btn--button.eds-btn--fill")))

進口


from selenium.webdriver.common.by import By

from selenium.webdriver.support.ui import WebDriverWait 

from selenium.webdriver.support import expected_conditions as EC


查看完整回答
反對 回復 2023-12-20
  • 1 回答
  • 0 關注
  • 170 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號