import time
from selenium import webdriver
from selenium.webdriver.common.by import By
option = webdriver.EdgeOptions()
option.add_experimental_option("detach", True)
option.add_experimental_option("excludeSwitches", ["enable-automation"])
option.add_experimental_option("useAutomationExtension",False)
option.add_argument("User-Agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0")
browser = webdriver.Edge(options=option)
browser.get("https://eproport.crecgec.com/#/home")
time.sleep(2)
browser.find_element(By.XPATH,"/html/body/app-root/layout-fullscreen/div[2]/div/div/nz-input-group/span/input").send_keys("钢")
time.sleep(3)
browser.find_element(By.XPATH,"/html/body/app-root/layout-fullscreen/div[2]/div/div/nz-input-group/span/span/button/span[2]").click()
time.sleep(3)
browser.find_element(By.XPATH,"/html/body/app-root/layout-fullscreen/div[5]/app-nobanner/app-notice-notice/nz-card[2]/div/nz-table/nz-spin/div/div/nz-table-inner-default/div/table/tbody/tr[1]/td[1]/span/a").click()
time.sleep(3)
代码如上,该如何修改呢? |