在谷歌浏览器的右上角点击三个点
选择设置
在设置的左边栏点击扩展程序
开启开发者模式
将下载并解压好的文件导入
下载地址
链接:https://pan.baidu.com/s/1PiSt3a6CCgMFjHQs4-h_Fg?pwd=qqul
提取码:qqul
以学生学籍信息管理系统为例
登陆
根据页面元素进行定位进行操作
import selenium from selenium import webdriver from selenium.webdriver.chrome.service import Service from selenium.webdriver.common.by import By from selenium.webdriver.support.select import Select import time options = webdriver.ChromeOptions() options.add_experimental_option('detach', True) driver = webdriver.Chrome(options=options) driver.implicitly_wait(10) time.sleep(1) driver.get('http://localhost:8085/xueji/index.jsp') time.sleep(1) driver.find_element(By.NAME,'zhanghao').send_keys('juzipi') time.sleep(1) driver.find_element(By.NAME, 'password').send_keys('51129') time.sleep(1) nr = driver.find_element(By.ID, "shenfen") # 实例化 select = Select(nr) select.select_by_visible_text("管理员") time.sleep(1) driver.find_element(By. ID, 'submit').click() style = driver.find_element(By.TAG_NAME,'style') assert style !=[] driver.find_element(By.LINK.TEXT,"学籍基本信息") # 定位到iframe iframe = driver.find_element(By.ID,"myIframe1") # 切换到iframe driver.switch_to_frame(iframe) driver.find_element(By.LINK.TEXT,"查看详情") #退出iframe driver.switch_to.default_content()
标签:webdriver,selenium,driver,element,---,import,find,软件测试 From: https://www.cnblogs.com/gnn40036/p/17474277.html