是否可以将浏览器的当前 URL 保存在 txt/csv 文件中?
Is it possible to save the current URL of your browser in a txt/csv file?
我想要一个脚本 运行 在后面保存我的网络浏览器的当前 URL,我一直在手动导航到网站。我的项目的用例是我想手动打开一个 Google 地图位置,并使后台脚本将当前 URL 保存在 csv 或 txt 文件中以提取 [=] 的坐标16=] 作为一个字符串。 (URL 看起来像这样:https://www.google.de/maps/@48.2881292,9.3802822,13.58z)是否有可能这样做?
使用python,你可以得到这样的url。
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
driver.get("https://google.com")
# do whatever you want to get to the right website
url = driver.current_url
print(url)
# Now you need to save the data
f=open("filename",'a')
f.write(url)
f.close()
我想要一个脚本 运行 在后面保存我的网络浏览器的当前 URL,我一直在手动导航到网站。我的项目的用例是我想手动打开一个 Google 地图位置,并使后台脚本将当前 URL 保存在 csv 或 txt 文件中以提取 [=] 的坐标16=] 作为一个字符串。 (URL 看起来像这样:https://www.google.de/maps/@48.2881292,9.3802822,13.58z)是否有可能这样做?
使用python,你可以得到这样的url。
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
driver = webdriver.Firefox()
driver.get("https://google.com")
# do whatever you want to get to the right website
url = driver.current_url
print(url)
# Now you need to save the data
f=open("filename",'a')
f.write(url)
f.close()