问题描述
我正在运行一个HTTP服务器,该服务器根据浏览器URL中的尺寸提供位图,即 localhost://image_x120_y30.bmp
。我的服务器正在无限循环中运行,我想在用户请求BITMAP时获取URL,最后我可以从URL中提取图像尺寸。
I am running an HTTP server which serves a bitmap according to the dimensions in the browser URL i.e localhost://image_x120_y30.bmp
. My server is running in infinite loop and I want to get the URL any time user requests for BITMAP, and at the end I can extract the image dimensions from the URL.
问题在这里询问:
无法解决我的问题,因为我正在无限循环中运行,并且我想继续获取当前URL,以便可以将请求的BITMAP传递给用户。
does not address my problem as I am running in infinite loop and I want to keep on getting the current URL so I can deliver the requested BITMAP to the user.
推荐答案
如果要使用Selenium进行网络导航:
If to use Selenium for web navigation:
from selenium import webdriver
driver = webdriver.Firefox()
print (driver.current_url)
这篇关于使用python从浏览器获取当前URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!