第五章 . Selenium Web 自动化模块 -【EC模块】expected_conditions模块介绍


#1.判断标题完全等于预期文本 res1 = EC.title_is("百度一下,你就知道") print(res1(driver)) #2.判断标题部分等于预期文本 res2 = EC.title_contains("百度一下") print(res2(driver)) #3.判断元素是否可见

第五章 . Selenium Web 自动化模块 - 【iframe】切换页面的iframe、handlers

示例地址:https://sahitest.com/demo/iframesTest.htm 1.iframe 切换 #1.创建浏览器对象 driver = webdriver.Chrome(service=Service('/usr/local/bin/chromedriver')) driver

Day18 - 1047.删除字符串中的所有相邻重复项


问题理解 我们需要删除字符串中所有相邻且相同的字符对,并重复这个过程直到无法继续删除。例如: 输入 "abbaca": 删除 "bb" → "aaca" 删除 "aa" → "ca"(最终结果) 解法思路 使用栈来模拟这个过程: 遍历字符串中的每个字符 如果栈不为空且栈顶元素等于当前字符,弹出栈顶元

Day18 - 20. 有效的括号


题目链接 :https://leetcode.cn/problems/valid-parentheses/description/ 问题理解: 我们需要判断一个只包含括号的字符串是否有效。有效的标准是: 每种左括号必须用相同类型的右括号闭合 括号必须按正确的顺序闭合(即后开的括号要先闭合) 每个右括

第五章 . Selenium Web 自动化模块 - 【cookies 操作】操作当前页面cookies 信息


1.获取cookies 信息 #2.单独获取某个coockie res2 = driver.get_cookie('BD_HOME') print(res2) time.sleep(100) 2.添加cookies信息 cookie = {"name":"aaa","value":"bbb"} dr

第五章 . Selenium Web 自动化模块 - 【滚动条操作】模拟鼠标滑轮滚动


示例地址:https://baike.baidu.com/ 1.滑动至页面底部 #加入显式等待 time.sleep(1) #1.滑动至页面底部 js = 'window.scrollTo(0, document.body.scrollHeight)' driver.execute_script(j

第五章 . Selenium Web 自动化模块 - 【单/复选框】单选框(Radio)复选框(CheckBox))


1.复选框勾选 #1.复选框 #方式1: el1 = driver.find_element(By.XPATH,".//input[@id='coding']") el1.click() #方式2: el2 = driver.find_element(By.XPATH,".//input[@id='

第五章 . Selenium Web 自动化模块 - 【下拉框操作】模拟操作下拉框


地址示例:https://sahitest.com/demo/selectTest.htm 1.确认选择 #1.按索引值选择下拉项 el1 = driver.find_element(By.ID,"s1Id") s = Select(el1) #实例化一个select对象 s.select_by_i

Day17 - 225. 用队列实现栈


题目链接:https://leetcode.cn/problems/implement-stack-using-queues/description/ 1)用 collections.deque 实现队列 deque 是双端队列,适合高效的头尾操作: class MyStack: def

Day17 - 232.用栈实现队列


题目链接:https://leetcode.cn/problems/implement-queue-using-stacks/description/ 题目解析: 1. 队列的特性 队列是 先进先出(FIFO) 的,比如排队买奶茶,先来的人先拿到奶茶。 但栈是 后进先出(LIFO) 的,就像一摞盘子