摘要:在 web 中,除了上面提到的元素和操作乊外,还有就是页面的提示框的处理了,页面 的警告框通常分为这几类 js alert 、 confirm 以及 prompt,这些警告框,我们都可以 通过 switch_to_alert()来处理。 对警告框的处理有以下几种:text 获叏警告框中的文本 a
阅读全文
摘要:多层框架定位 导入 webdriver driver = webdriver.Firefox() 打开浏览器 driver.get('file:///D:/test/test.html') 打开 test.html driver.switch_to_frame('f2') 先切换到 f2 的 fra
阅读全文
摘要:鼠标键盘操作 在浏览器中,通常会用到鼠标来迚行操作,比如右键菜单中选择一个操作,在 selenium 中提供了下列鼠标相关操作。 ActionChains 类提供了以下方法: context_click()右击 ActionChains(driver).context_click(test).per
阅读全文
摘要:智能等待 隐式等待:implicitly_wait() 则默认每隔 0.5 秒检查一次,直到 10 秒后超时,如果在 10 秒内完成,则继续执行代码。 显式等待:WebDriverWait() WebDriverWait(driver,10).until(expected_conditions.pr
阅读全文
摘要:我觉得我我代码没有优化,先写出线性脚本,功能至少先实现了再说 import unittestfrom time import sleepimport self as selffrom selenium import webdriverfrom selenium.webdriver.common.by
阅读全文
摘要:常用Shell bash sh zsh 变量 ls cd a=1 (变量定义的时候左右没有空格) (echo 向屏幕输出 ) echo $a (输出和引用a这个变量) a=hello echo a 变量定义大小写敏感 a="hello world" 当遇到空格的时候用引号 a=‘hello worl
阅读全文