Python 如何在QWebView中单击提交按钮?

Python 如何在QWebView中单击提交按钮?,python,forms,qt,pyqt,pyside,Python,Forms,Qt,Pyqt,Pyside,我有以下代码(排除类构造函数等)-我正在使用PySide btw: self.view = QWebView() frame = self.view.page().mainFrame() document = frame.documentElement() search = document.findFirst("input[name=q]") search.setAttribute("value", "srbija") button = document.findFirst("input[

我有以下代码(排除类构造函数等)-我正在使用PySide btw:

self.view = QWebView()

frame = self.view.page().mainFrame()
document = frame.documentElement()
search = document.findFirst("input[name=q]")
search.setAttribute("value", "srbija")

button = document.findFirst("input[name=btnK]")

正如您可能已经注意到的,这是直接从google.com主页上获得的。我试图基本上搜索页面。但我想不出点击“谷歌搜索”按钮。文档中只提到了
按钮。evaluateJavaScript(“click()”)
,但这只调用JS方法-在这种情况下,我不需要任何JS方法,我需要实际单击按钮

为了关闭此文件,使其看起来不会无人应答…:)

尝试将
click()
替换为
this。根据以下问题,单击()


这有帮助吗@霍斯蒂尔福克为什么是的,是的。因此,这只是将
click()
替换为
this的问题。click()
这提醒了我,我真的需要学习JavaScript。。。谢谢!