gpt4 book ai didi

python - 使用python从浏览器获取当前URL

转载 作者:太空狗 更新时间:2023-10-29 21:39:33 24 4
gpt4 key购买 nike

我正在运行一个 HTTP 服务器,该服务器根据浏览器 URL 中的尺寸提供位图,即 localhost://image_x120_y30.bmp。我的服务器在无限循环中运行,我想在用户请求 BITMAP 时随时获取 URL,最后我可以从 URL 中提取图像尺寸。

这里问的问题:

How to get current URL in python web page?

没有解决我的问题,因为我在无限循环中运行,我想继续获取当前 URL,以便我可以将请求的 BITMAP 传递给用户。

最佳答案

如果使用 Selenium 进行网页导航:

from selenium import webdriver
driver = webdriver.Firefox()
print (driver.current_url)

关于python - 使用python从浏览器获取当前URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30479290/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com