10 2020 档案
摘要:定位不到元素的原因:可能是 不可见元素定位原因,某些情况元素的visibility为hidden或者display属性为none,我们在页面看不到但是实际是存在页面的一些元素,这时候用 is_displayed() 来判断 来自 https://www.cnblogs.com/awakenedy/p
阅读全文
摘要:from selenium.webdriver.support.select import Select Select(self.driver.find_element_by_id("edu_from_month")).select_by_value("8")time.sleep(3)Select(
阅读全文
摘要:某个操作点击之后形成第二个标签就可以进行下方的代码的书写 index = self.driver.current_window_handle handles = self.driver.window_handlescurrent= None for handle in handles: if han
阅读全文
摘要:import cx_Oracle conn = cx_Oracle.connect('数据库名字', '密码', '**', encoding='UTF-8') cursor = conn.cursor() number = '2020-09-08 11:29:18' cursor.execute(
阅读全文
摘要:与谷歌浏览器的差不多的配置 需要找到相应的版本 后期补充
阅读全文
摘要:1、Xpath表达式:比较强大、灵活的选择元素的方式 2、目前主流的浏览器chrome、firefox、edge、safari都支持xpath语法,xpath和xpath2两个版本,目前支持的是xpath1的语法 3、Xpath:爬虫框架Scrapy、手机APP框架 Appium 一、 根据id属性
阅读全文
摘要:1、alert类型的对话框 一般只有确认的按钮 switch_to_alert() #定位弹出对话 #获取对话框的提示信息 (1、print(driver.switch_to.alert.text) #这是一个alert #点击确认按钮 (2、driver.switch_to.alert.accep
阅读全文
摘要:在自动化测试中,可能会使用到滚动条的模拟操作,此处介绍两种比较简单的滚动条的操作。 仅仅为个人理解,如果有问题可以指出。 第一种:整个页面的滚动条 直接使用: from selenium import webdriver self.driver.execute_script("window.scro
阅读全文
摘要:file_path=r'E:\pythonProject2\xxx.jpg' self.driver.find_element(By.ID,"fulltextFileInput").send_keys(file_path) 需要注意的地方就是,找到这个input的属性
阅读全文
摘要:self.driver.find_element(By.CSS_SELECTOR,"xxx").click()first_handle = self.driver.current_window_handle #如果出现弹框try: first_handle = self.driver.current
阅读全文
摘要:1、鼠标双击 例如有些地方需要使用到双击修改信息等,就需要使用到鼠标双击模拟操作 from selenium import webdriver from selenium.webdriver import ActionChains action_chains = ActionChains(self.
阅读全文
摘要:形如:此下方的出现的提示框:分享成功。 1、 如果直接获取,可能会因为时间过短而导致捕捉不到,因此可以设置等待时间 。 2、关于这个弹框的定位: 由于此框一闪而过,想要获取id或者class可能需要一些时间,可以通过 self.driver = webdriver.Chrome()self.driv
阅读全文
摘要:1、粗暴的等待时间方式 self.driver = webdriver.Chrome() self.driver.get("https://www.baidu.com") time.sleep(10) 不管结果如何都需要等待十秒,适用于调试,也可以用在代码中 不够灵活 2、隐式等待 self.dri
阅读全文
摘要:1、下载python 3.0版本以上 直接搜索python https://www.python.org/getit/ 具体教程参考:https://blog.csdn.net/qq_25814003/article/details/80609729 2、安装 pycharm 方便编写代码,pyth
阅读全文