You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The issue I’m encountering is as follows: I’m trying to write a semi-automated Python script that uses the Selenium library to access the history page in the Edge browser, input a specified string for searching, and delete the results obtained after the search. However, I’m having trouble correctly navigating to the user’s history page. The code that GPT helped me write only accesses a history page unrelated to the user, rather than the user’s actual history page. Later, I attempted to access just the user’s history page, but that also failed. Could you provide me with some advice?
my code is as following:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver.edge.service import Service # 导入 Service 类
import time
if name == "main":
search_string = input("请输入要删除的字符串: ")#input the string which you want to deleted in edge's history
if confirm_action():
delete_edge_history(search_string)
else:
print("操作已取消。")
'''
The text was updated successfully, but these errors were encountered:
Here’s the English translation of your text:
The issue I’m encountering is as follows: I’m trying to write a semi-automated Python script that uses the Selenium library to access the history page in the Edge browser, input a specified string for searching, and delete the results obtained after the search. However, I’m having trouble correctly navigating to the user’s history page. The code that GPT helped me write only accesses a history page unrelated to the user, rather than the user’s actual history page. Later, I attempted to access just the user’s history page, but that also failed. Could you provide me with some advice?
my code is as following:
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium import webdriver
from selenium.webdriver.edge.service import Service # 导入 Service 类
import time
def check_edge_history_page():
options = webdriver.EdgeOptions()
# 指定Edge浏览器的路径
options.binary_location = r"C:/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
if name == "main":
check_edge_history_page()
'''
def confirm_action():
confirmation = input("确认删除与该字符串相关的历史记录吗?(y/n): ")
return confirmation.lower() == 'y'
def delete_edge_history(search_string):
# 使用 Edge 浏览器驱动
driver = webdriver.Edge() # 请确保你已经下载了 Edge WebDriver 并设置到环境变量,或指定路径
search_url = f"edge://history/all?q={search_string}"
# 打开 Edge 历史记录的搜索结果页面
driver.get(search_url)
if name == "main":
search_string = input("请输入要删除的字符串: ")#input the string which you want to deleted in edge's history
if confirm_action():
delete_edge_history(search_string)
else:
print("操作已取消。")
'''
The text was updated successfully, but these errors were encountered: