python使用selenium函数运行完之后浏览器自动退出我想要浏览器不自动退出上网搜索了许多答案基本都是使用options中的add_experimental_option函数
但是运行之后提示我:AttributeError: 'Options' object has no attribute 'add_experimental_option'没有这个函数
from selenium import webdriver
# 获取配置对象 => 什么样的浏览器就选择什么浏览器配置
option = webdriver.FirefoxOptions()
option.add_experimental_option("detach", True)
# 获取driver对象, 并将配置好的option传入进去
driver = webdriver.Firefox(options=option)
driver.get('https://www.baidu.com')
搜索了好久都没有找到解决的办法 希望大家能够不吝指教!
selenium Version: 4.8.0
Python 3.11.1