简体   繁体   中英

How to simulate click event for a link using Qt with python

I want to screen scrape a web site having multiple pages. These pages are loaded dynamically without changing the URL.

I dont want to use Selenium since it opens browser every time you need content.Does QT work the same way?If not, how can i simulate click event using qt?

PS:Google provided vague answer Thanks in advance

There's already a project that does just that: ghost.py . It uses PyQt4's or PySide's QWebkit browser internally.

Here's their example code:

from ghost import Ghost

ghost = Ghost()
page, extra_resources = ghost.open("http://jeanphi.fr")

assert page.http_status==200 and 'jeanphix' in ghost.content

You will most likely be using ghost.click() to interact with your webpage:

ghost.click('#selector')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM