catchxiaoshuang
7th June 2015, 07:21
Now i open a URL by QWebView in my PyQt code, then i want to trigger a click on an anchor, the anchor code is below:
<a class="btn-bid" href="javascript:;" id="exchange-btn" data-sk="exchange">exchange</a>
and this is my code below:
code = """
document.getElementById("exchange-btn").click()
"""
self.view.page().mainFrame().evaluateJavaScript(co de)
but is did not work for me.
I try the code :document.getElementById("exchange-btn").click() in Firefox and one other browser console(by F12), the code works fine.
There is some error in my code or something missing? My Qt version is 4.8.6 and we can not use jquery in this webpage.
Is there someone can tell me how to solve this problem??
<a class="btn-bid" href="javascript:;" id="exchange-btn" data-sk="exchange">exchange</a>
and this is my code below:
code = """
document.getElementById("exchange-btn").click()
"""
self.view.page().mainFrame().evaluateJavaScript(co de)
but is did not work for me.
I try the code :document.getElementById("exchange-btn").click() in Firefox and one other browser console(by F12), the code works fine.
There is some error in my code or something missing? My Qt version is 4.8.6 and we can not use jquery in this webpage.
Is there someone can tell me how to solve this problem??