从GridView删除一行时,我希望显示一个模式确认框。
我已经尝试了下面的代码,但是我想在模态弹出对话框中看起来更好。
import itertools
import requests
from selenium.webdriver import Chrome
from selenium.webdriver.common.keys import Keys
driver = Chrome()
driver.get('https://www.google.com/')
# Search 'selenium'
search = driver.find_element_by_css_selector('input[aria-label="Search"]')
search.send_keys('selenium')
search.send_keys(Keys.ENTER)
# Resuls div
container = driver.find_element_by_id('rso')
results = container.find_elements_by_css_selector('.bkWMgd')
del results[1]
# links
_links = []
for result in results:
_links.append([r.get_attribute('href') for r in result.find_elements_by_css_selector('.r>a')])
driver.quit()
links = list(itertools.chain.from_iterable(_links))
for link in links:
r = requests.get(link)
print(link, r.status_code)
我的.aspx部分包含gridview的代码。
https://www.seleniumhq.org/ 200
https://www.seleniumhq.org/projects/webdriver/ 200
https://www.webmd.com/a-to-z-guides/supplement-guide-selenium 200
https://www.healthline.com/nutrition/selenium-benefits 200
https://github.com/SeleniumHQ/selenium 200
https://en.wikipedia.org/wiki/Selenium_(software) 200
https://www.medicalnewstoday.com/articles/287842.php 200
https://ods.od.nih.gov/factsheets/Selenium-Consumer/ 200
https://selenium-python.readthedocs.io/ 200
https://selenium-python.readthedocs.io/installation.html 200
我的“ btnFileDelete”删除代码。
OnClientClick="return confirm('Are you sure you want to delete this file?')"
我希望模态弹出,提示用户是否要删除文件。如果为“是”,则删除文件;如果为“否”,则不执行任何操作。