我正在尝试通过 python 中的 selenium 访问并单击“X”按钮,以便能够重定向到下一页并从中加载一些信息。但是,我很难找到该元素,不知道是因为在类中还是其他原因。你们能帮我实际点击按钮吗?下面的代码是我目前拥有的。
先感谢您:
from selenium.webdriver import Firefox
from selenium.webdriver.firefox.options import Options
import time
from selenium import webdriver
driver = webdriver.Firefox()
url = 'https://shop.axs.co.uk/Lw%2fYCwAAAAA6dpvSAAAAAABB%2fv%2f%2f%2fwD%2f%2f%2f%2f%2fBXRoZW8yAP%2f%2f%2f%2f%2f%2f%2f%2f%2f%2f'
opts = Options()
browser = Firefox(options=opts)
browser.get(url)
#wait for all elements to load
time.sleep(5)
#working lines are commented out
#search_form = browser.find_element_by_class_name("modal-open")
browser.find_element_by_class_name('btn-close-svg pull-right').click()
一只斗牛犬
相关分类