台州seo网站建设费用成都百度公司怎么样
web/
2025/9/26 1:36:49/
文章来源:
台州seo网站建设费用,成都百度公司怎么样,互站网怎么样,福州网站设计哪家比较好点此获取更多相关资料 本文为霍格沃兹测试开发学社学员学习笔记分享 原文链接#xff1a;https://ceshiren.com/t/topic/27071 一、文件上传 input标签可以直接使用send_keys(“文件路径/文件名”)上传文件 ele01 driver.find_element(By.ID,“上传按钮id”)ele01.send_keys(…点此获取更多相关资料 本文为霍格沃兹测试开发学社学员学习笔记分享 原文链接https://ceshiren.com/t/topic/27071 一、文件上传 input标签可以直接使用send_keys(“文件路径/文件名”)上传文件 ele01 driver.find_element(By.ID,“上传按钮id”)ele01.send_keys(“文件路径/文件名”) def test_upload_file(self):self.driver.get(https://image.baidu.com/)self.driver.find_element(By.XPATH, //*[classst_camera_off]).click()ele01 self.driver.find_element(By.ID, stfile)ele01.send_keys(rC:\Users\Chen\PycharmProjects\hogwartsCourse\UIAutoTest\UI_L2\pictures\pic01.png)time.sleep(5)print(self.driver.title)二、弹窗处理
2.1、弹窗处理机制 在页面操作时有时会遇到JS生成的alert、confirm、prompt弹窗我们可以使用switch_to.alert()方法定位到。 操作alert常用的方法 switch_to.alert()获取当前页面的弹窗text返回弹窗中的文本信息accept()接受现有的弹窗dismiss()解算取消现有的弹窗send_keys()发送文本至弹窗 def test_accept_alert(self):self.driver.get(https://www.runoob.com/try/try.php?filenamejqueryui-api-droppable)self.driver.switch_to.frame(iframeResult)ele01 self.driver.find_element(By.ID, draggable)print(ele01.text)ele02 self.driver.find_element(By.ID, droppable)print(ele02.text)self.action.drag_and_drop(ele01, ele02).perform()time.sleep(3)self.driver.switch_to.alert.accept()self.driver.switch_to.parent_frame()self.driver.find_element(By.ID,submitBTN).click()
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/web/81923.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!