介绍一下Python中webbrowser的用法
webbrowser模块提供了一个高级接口来显示基于Web的文档,大部分情况下只需要简单的调用open()方法。
webbrowser定义了如下的异常:
exception webbrowser.Error, 当浏览器控件发生错误是会抛出这个异常
webbrowser有以下方法:
webbrowser.open(url[, new=0[, autoraise=1]])
这个方法是在默认的浏览器中显示url, 如果new = 0, 那么url会在同一个浏览器窗口下打开,如果new = 1, 会打开一个新的窗口,如果new = 2, 会打开一个新的tab, 如果autoraise = true, 窗口会自动增长。
webbrowser.open_new(url)
在默认浏览器中打开一个新的窗口来显示url, 否则,在仅有的浏览器窗口中打开url
webbrowser.open_new_tab(url)
在默认浏览器中当开一个新的tab来显示url, 否则跟open_new()一样
webbrowser.get([name]) 根据name返回一个浏览器对象,如果name为空,则返回默认的浏览器
webbrowser.register(name, construtor[, instance])
注册一个名字为name的浏览器,如果这个浏览器类型被注册就可以用get()方法来获取。
webbrowser定义了如下的异常:
exception webbrowser.Error, 当浏览器控件发生错误是会抛出这个异常
webbrowser有以下方法:
webbrowser.open(url[, new=0[, autoraise=1]])
这个方法是在默认的浏览器中显示url, 如果new = 0, 那么url会在同一个浏览器窗口下打开,如果new = 1, 会打开一个新的窗口,如果new = 2, 会打开一个新的tab, 如果autoraise = true, 窗口会自动增长。
webbrowser.open_new(url)
在默认浏览器中打开一个新的窗口来显示url, 否则,在仅有的浏览器窗口中打开url
webbrowser.open_new_tab(url)
在默认浏览器中当开一个新的tab来显示url, 否则跟open_new()一样
webbrowser.get([name]) 根据name返回一个浏览器对象,如果name为空,则返回默认的浏览器
webbrowser.register(name, construtor[, instance])
注册一个名字为name的浏览器,如果这个浏览器类型被注册就可以用get()方法来获取。
【介绍一下Python中webbrowser的用法】相关文章
7. JAVA语言如何进行异常处理,关键字:throws,throw,try,catch,finally分别代表什么意义?在try块中可以抛出异常吗?
8. 软件测试LoadRunner面试题:If web server, database and Network are all fine where could be the problem?
9. 请解释一下webService? 如何用.net实现webService
10. 软件测试LoadRunner面试题:What is think time? How do you change the threshold?
本文来源:https://www.mianshiwenti.com/a13509.html
进入下载页面
﹝介绍一下Python中webbrowser的用法﹞相关内容
- 软件测试LoadRunner面试题:How did you find web server related issues?
- Python中如何定义一个函数
- Python中pass语句的作用是什么
- 软件测试LoadRunner面试题:If you want to stop the execution of your script on error, how do you do that?
- 如何反序的迭代一个序列?how do I iterate over a sequence in reverse order
- What\'s the difference between deep copy and shallow copy? (深拷贝与浅拷贝有什么区别)
- 软件测试LoadRunner面试题:How did you plan the Load? What are the Criteria?
- Python里面search()和match()的区别
- 介绍一下SQL Server的全文索引
- 介绍一下sql server的安全性