本文整理汇总了Python中PyQt4.QtWebKit.QWebInspector.close方法的典型用法代码示例。如果您正苦于以下问题:Python QWebInspector.close方法的具体用法?Python QWebInspector.close怎么用?Python QWebInspector.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtWebKit.QWebInspector
的用法示例。
在下文中一共展示了QWebInspector.close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GRobot
# 需要导入模块: from PyQt4.QtWebKit import QWebInspector [as 别名]
# 或者: from PyQt4.QtWebKit.QWebInspector import close [as 别名]
#.........这里部分代码省略.........
# var allsuspects=document.getElementsByTagName(targetelement)
# for (var i=allsuspects.length; i>=0; i--){ //search backwards within nodelist for matching elements to remove
# if (allsuspects[i] && allsuspects[i].getAttribute(targetattr)!=null )
# allsuspects[i].parentNode.removeChild(allsuspects[i]); //remove element by calling parentNode.removeChild()
# }
# """)
def filter_resources(self, pattern):
"""Filter resources with pattern.
@param pattern: Match pattern.
@param resources:
@return: @raise:
"""
if isinstance(pattern, basestring):
is_match = lambda x: pattern == x
elif isinstance(pattern, _pattern_type):
is_match = lambda x: pattern.match(x)
elif hasattr(pattern, '__call__'):
is_match = pattern
else:
raise TypeError, 'pattern must be one of str,re.compile,callable'
return filter(lambda x: is_match(x.request_url), self.http_resources)[:]
def save(self, path):
"""Save current page content to the path.
@param path: The path to save.
"""
f = open(path, 'w')
f.write(self.content.encode('utf-8'))
f.close()
def global_exists(self, global_name):
"""Checks if javascript global exists.
@param global_name: The name of the global.
"""
return self.evaluate('!(typeof %s === "undefined");' %
global_name)
def load_cookies( self, cookie_storage, keep_old=False ):
"""load from cookielib's CookieJar or Set-Cookie3 format text file.
@param cookie_storage: file location string on disk or CookieJar instance.
@param keep_old: Don't reset, keep cookies not overridden.
"""
def toQtCookieJar( PyCookieJar, QtCookieJar ):
allCookies = QtCookieJar.cookies if keep_old else []
for pc in PyCookieJar:
qc = toQtCookie(pc)
allCookies.append(qc)
QtCookieJar.setAllCookies(allCookies)
def toQtCookie(PyCookie):
qc = QNetworkCookie(PyCookie.name, PyCookie.value)
qc.setSecure(PyCookie.secure)
if PyCookie.path_specified:
qc.setPath(PyCookie.path)
if PyCookie.domain != "":
qc.setDomain(PyCookie.domain)
if PyCookie.expires != 0: