我想从页面中单击“进行中的球门线”下的所有矩形图标(图标看起来像足球场)。我尝试了很多次但没有成功。如果有人知道如何单击这些所有图标,请帮助我。
from time import sleep
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
chrome_options = Options()
# chrome_options.add_argument("--headless")
chrome_options.add_argument('--start-maximized')
driver = webdriver.Chrome(options=chrome_options, executable_path=r"chromedriver.exe")
driver.execute_cdp_cmd("Page.addScriptToEvaluateOnNewDocument", {"source":
"""Object.defineProperty(navigator,
'webdriver', {get: () => undefined})"""})
url = 'https://www.bet365.com/#/IP/B1'
driver.get(url)
sleep(10)
res = driver.execute_script("return document.documentElement.outerHTML")
sleep(10)
click_icon = driver.find_element_by_css_selector(".ovm-MediaIconContainer_Buttons div")
click_icon.click()
aluckdog
相关分类