修改这段代码 # 打开浏览器 driver = webdriver.Chrome() # 打开网页 driver.get("http://10.0.1.230:8080/#/SampleExtraction/cmm/146") # 打开网页 driver.get("http://10.0.1.230:8080/#/RNAinstance/cmm/20") # 找到表格元素 table = driver.find_element_by_id("table") # 获取表格内容 rows = table.find_elements_by_tag_name("tr") table_list = [] for row in rows: cols = row.find_elements_by_tag_name("td") row_list = [] for col in cols: row_list.append(col.text) table_list.append(row_list) # 将表格内容复制到剪贴板中 table_string = "" for row in table_list: for col in row: table_string += col + "\t" table_string += "\n" pyperclip.copy(table_string) # 打开目标软件 driver.get("http://10.0.1.230:8080/#/SampleExtraction/cmm/146") # 定位目标位置并粘贴表格内容 target_position = driver.find_element_by_id("target") target_position.send_keys(Keys.CONTROL, 'v') # 在整体订单中改到预审 input_box = driver.find_element_by_id("input-box") input_box.send_keys("value") button = driver.find_element_by_id("button") button.click() # 打开目标软件 driver.get("http://10.0.1.230:8080/#/RNAinstance/cmm/20") # 定位目标位置并粘贴表格内容 target_position = driver.find_element_by_id("target") target_position.send_keys(Keys.CONTROL, 'v') # 提交预审 input_box = driver.find_element_by_id("input-box") input_box.send_keys("value") button = driver.find_element_by_id("button") button.click() # 关闭浏览器 driver.quit() ```
时间: 2024-04-23 15:22:12 浏览: 144
# 打开浏览器
driver = webdriver.Chrome()
# 打开第一个网页
driver.get("http://10.0.1.230:8080/#/SampleExtraction/cmm/146")
# 找到表格元素
table = driver.find_element_by_id("table")
# 获取表格内容
rows = table.find_elements_by_tag_name("tr")
table_list = []
for row in rows:
cols = row.find_elements_by_tag_name("td")
row_list = []
for col in cols:
row_list.append(col.text)
table_list.append(row_list)
# 将表格内容复制到剪贴板中
table_string = ""
for row in table_list:
for col in row:
table_string += col + "\t"
table_string += "\n"
pyperclip.copy(table_string)
# 定位目标位置并粘贴表格内容
target_position = driver.find_element_by_id("target")
target_position.send_keys(Keys.CONTROL, 'v')
# 在第一个网页中提交预审
input_box = driver.find_element_by_id("input-box")
input_box.send_keys("value")
button = driver.find_element_by_id("button")
button.click()
# 关闭第一个网页
driver.quit()
# 打开第二个网页
driver = webdriver.Chrome()
driver.get("http://10.0.1.230:8080/#/RNAinstance/cmm/20")
# 定位目标位置并粘贴表格内容
target_position = driver.find_element_by_id("target")
target_position.send_keys(Keys.CONTROL, 'v')
# 在第二个网页中提交预审
input_box = driver.find_element_by_id("input-box")
input_box.send_keys("value")
button = driver.find_element_by_id("button")
button.click()
# 关闭第二个网页
driver.quit()
阅读全文