如何使用特定浏览器获取 url?
How to get url with specifed browser?
这是我的代码:
import requests
from bs4 import BeautifulSoup
Url = "https://gmail.com"
R = requests.get(Url)
Soup = BeautifulSoup(R.text,"lxml")
print(Soup)
但我需要我的 cookie、登录数据和其他东西,它们存储在 google chrome 中,所以我想通过 google [=21= 获取 url ].
Google Chrome 的路径:“C:\Program Files\Google\Chrome\Application\chrome.exe”
这可能吗?谢谢...
问题是你必须使用selenium,下载chrome webdriver
`选项 = webdriver.ChromeOptions()
options.add_argument('--开始最大化')
options.add_argument('--禁用扩展')
driver_path='C:\Users\your_user_here\Downloads\chromedriver.exe'
驱动程序 = webdriver.Chrome(driver_path, chrome_options=选项)`
这是我的代码:
import requests
from bs4 import BeautifulSoup
Url = "https://gmail.com"
R = requests.get(Url)
Soup = BeautifulSoup(R.text,"lxml")
print(Soup)
但我需要我的 cookie、登录数据和其他东西,它们存储在 google chrome 中,所以我想通过 google [=21= 获取 url ].
Google Chrome 的路径:“C:\Program Files\Google\Chrome\Application\chrome.exe”
这可能吗?谢谢...
问题是你必须使用selenium,下载chrome webdriver `选项 = webdriver.ChromeOptions() options.add_argument('--开始最大化') options.add_argument('--禁用扩展')
driver_path='C:\Users\your_user_here\Downloads\chromedriver.exe'
驱动程序 = webdriver.Chrome(driver_path, chrome_options=选项)`