本文整理汇总了Python中PyQt5.QtWebEngineWidgets.QWebEngineView.url方法的典型用法代码示例。如果您正苦于以下问题:Python QWebEngineView.url方法的具体用法?Python QWebEngineView.url怎么用?Python QWebEngineView.url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWebEngineWidgets.QWebEngineView
的用法示例。
在下文中一共展示了QWebEngineView.url方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DrrrWindow
# 需要导入模块: from PyQt5.QtWebEngineWidgets import QWebEngineView [as 别名]
# 或者: from PyQt5.QtWebEngineWidgets.QWebEngineView import url [as 别名]
#.........这里部分代码省略.........
# ["bubble","userin","userout"]
print (content)
QtMultimedia.QSound.play("./img/"+content+".wav")
def readyRead(self):
pass
# print self.NetworkAccessManager.readAll()
def NetworkAccessManagerReplyFinished(self,response):
# NO USE
# print response.readAll()
# print response.header(QNetworkRequest.ContentTypeHeader)
# print response.url()
# self.bbb = response.readAll()
response.deleteLater()
def contentsChanged(self):
# print 'contentsChanged'
pass
def _javascript_alert(self, webframe, message):
print ('_javascript_alert')
def _javascript_console_message(self, message, line, sourceid):
print ("_javascript_console_message")
def _javascript_confirm(self, webframe, message):
print ("_javascript_confirm")
return QWebPage.javaScriptConfirm(self.WebView.page(), webframe, message)
def _javascript_prompt(self, webframe, message, defaultvalue, result):
print ("_javascript_prompt")
def linkClicked(self,url):
print (url)
# 获取ini格式的设置
def getSetting(self):
'''获取应用设置'''
self.settings = QtCore.QSettings("DrrrChatRoom.ini", QtCore.QSettings.IniFormat)
def loadStarted(self):
if 'http://drrr.com/' == str(self.WebView.url().toString()):
frame = self.WebView.page()
# name = frame.findFirstElement("input#form-name.home-name-input")
# username = name.evaluateJavaScript("this.value")
# print (username)
# language = frame.findFirstElement("#form-language-select")
# language = language.evaluateJavaScript("this.value")
# print (language)
frame.runJavaScript("""
var iconFun = function(){
var elementsLI = document.getElementsByTagName('li')
var length = document.getElementsByTagName('li').length;
for(var i = 0; i < length ; ++i){
if(elementsLI[i].getElementsByTagName('div')[0].className.indexOf("active")>=0){
var icon = elementsLI[i].getElementsByTagName('input')[0].value;
}
}
return icon
};
""")
icon = frame.runJavaScript("""iconFun()""")
print (icon)