#!/usr/bin/env python
# -*- coding:utf-8 -*-
'''
Selenium3+webdriver学习笔记13(js操作应用:弹出框无效如何处理)
'''
from selenium import webdriver
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.select import Select
import time,os # about:addons 火狐浏览器安装组件,访问的地址 # <input id="kw" name="wd" class="s_ipt" value="" maxlength="255" autocomplete="off">
#id
keys="设置"
delay=3
url="https://www.baidu.com/"
driver=webdriver.Firefox() driver.get(url) mouse=driver.find_element_by_link_text(keys)
ActionChains(driver).move_to_element(mouse).perform()
time.sleep(delay) driver.find_element_by_link_text("搜索设置").click()
time.sleep(delay) # <select name="NR" id="nr">
# <option value="10" selected="">每页显示10条</option>
# <option value="20">每页显示20条</option>
# <option value="50">每页显示50条</option>
# </select> se=driver.find_element_by_id("nr")
Select(se).select_by_index(2) #一般方式
# <div id="gxszButton"><a href="#" class="prefpanelgo">保存设置</a><a href="#" class="prefpanelrestore">恢复默认</a></div>
driver.find_element("id","gxszButton").click()
driver.find_element("class name","prefpanelgo").click() #脚本方式
js='document.getElementsByClassName("prefpanelgo")[0].click();'
driver.execute_script(js) driver.quit()

Python3+Selenium3+webdriver学习笔记13(js操作应用:弹出框无效如何处理)的更多相关文章

  1. Python3+Selenium3+webdriver学习笔记8(单选、复选框、弹窗处理)

    #!/usr/bin/env python# -*- coding:utf-8 -*-'''Selenium3+webdriver学习笔记8(单选.复选框.弹窗处理)''' from selenium ...

  2. Python3+Selenium3+webdriver学习笔记12(js操作应用:滚动条 日历 内嵌div)

    #!/usr/bin/env python# -*- coding:utf-8 -*-'''Selenium3+webdriver学习笔记12(js操作应用:滚动条 日历 内嵌div)'''from ...

  3. Python3+Selenium3+webdriver学习笔记14(等待判断 鼠标事件 )

    !/usr/bin/env python -*- coding:utf-8 -*-'''Selenium3+webdriver学习笔记14(等待判断 鼠标事件 )'''from selenium im ...

  4. Python3+Selenium3+webdriver学习笔记9(发送富文本信息及上传文件处理)

    #!/usr/bin/env python# -*- coding:utf-8 -*-'''Selenium3+webdriver学习笔记9(发送富文本信息及上传文件处理)'''from seleni ...

  5. Python3+Selenium3+webdriver学习笔记11(cookie处理)

    #!/usr/bin/env python# -*- coding:utf-8 -*-'''Selenium3+webdriver学习笔记11(cookie处理)'''from selenium im ...

  6. Python3+Selenium3+webdriver学习笔记10(元素属性、页面源码)

    #!/usr/bin/env python# -*- coding:utf-8 -*-'''Selenium3+webdriver学习笔记10(元素属性.页面源码)'''from selenium i ...

  7. Python3+Selenium3+webdriver学习笔记7(选择多链接的结果、iframe、下拉框)

    #!/usr/bin/env python# -*- coding:utf-8 -*- from selenium import webdriverfrom selenium.webdriver.co ...

  8. Python3+Selenium3+webdriver学习笔记6(多窗口切换处理)

    #!/usr/bin/env python# -*- coding:utf-8 -*- from selenium import webdriverfrom selenium.webdriver.co ...

  9. Python3+Selenium3+webdriver学习笔记5(模拟常用键盘和鼠标事件)

    #!/usr/bin/env python# -*- coding:utf-8 -*- from selenium import webdriverfrom selenium.webdriver.co ...

随机推荐

  1. CF-845B

    B. Luba And The Ticket time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  2. B - Simple Game

    B - Simple Game Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Su ...

  3. 连接带密码的access数据库

    在网上找了很多都不靠谱,稀里哗啦的弄一堆连接字符串,很不优雅. 这个方法很简单: 1.在“连接”这页中,下方有“输入登录数据库的信息”用户名:admin,并在下面选择“空白密码” 2.在“所有”这页的 ...

  4. VMWare虚拟机Bridged类型网卡ping不通的原因和解决办法

    要使VM与局域网内的其他机器一个子网,VM的网卡设置使用桥接.本来一直正常好好的, 突然有一天,遇到VMWare虚拟机Bridged类型网卡ping不通,设置,重启,查看VM网络设置,重装VMWare ...

  5. GTK学习笔记之Linux下Gtk环境搭建

    下面介绍下Ubuntu 环境下具体的安装过程: 1.配置安装gcc/g++/gdb/make 等基本编程工具(必须装好) 刚装好的Ubuntu系统中已经有GCC了,但是这个GCC几乎什么文件都不能编译 ...

  6. Xilinx SDSoc 加载opencv库

    Xilinx SDSoc 加载opencv库需要下载两个文件 xfopencv 和 Revision Platform, Revision Platform需要和具体的开发板型号对应,我用的是zcu1 ...

  7. Spring Security认证提供程序

    1.简介 本教程将介绍如何在Spring Security中设置身份验证提供程序,与使用简单UserDetailsService的标准方案相比,提供了额外的灵活性. 2. The Authentica ...

  8. Keras AttributeError 'NoneType' object has no attribute '_inbound_nodes'

    问题说明: 首先呢,报这个错误的代码是这行代码: model = Model(inputs=input, outputs=output) 报错: AttributeError 'NoneType' o ...

  9. 3damx平滑组注意事项

    需要在Editable Poly->面级别,选中(需要平滑的)面,然后去点平滑组或自动平滑 如果出现下图的情况,说明可能是有多余点,点没缝合 max中确认,确实是点没缝合导致

  10. [UE4]如何替换角色Mesh上的Material材质

    http://www.dawnarc.com/2016/10/ue4%E5%A6%82%E4%BD%95%E6%9B%BF%E6%8D%A2%E8%A7%92%E8%89%B2mesh%E4%B8%8 ...